Project

General

Profile

Actions

Feature #15840

open

configuration path search

Added by nobu (Nobuyoshi Nakada) over 5 years ago. Updated over 5 years ago.

Status:
Open
Assignee:
-
Target version:
-
[ruby-core:92609]

Description

Related to #15828, a standard method to search configuration files would be nice.

We (naruse and nobu) talked about it and agreed on Etc.config_file

To load a config file as Ruby script:

Etc.config_file(basename) {|path| load(path) rescue nil}

or just search the file:

file = Etc.config_file

basename will be defaulted to the base name of the program name,$0.

A flag to write new file:

Etc.config_file(create: true) {|f| FileUtils.mdir_p(File.basename(f)); File.write(f, content)}

Links:
XDG Base Directory Specification
Haiku Filesystem layout

Updated by shevegen (Robert A. Heiler) over 5 years ago

I can't say much about the API/name but the functionality looks useful/good in my opinion.

Actions #2

Updated by nobu (Nobuyoshi Nakada) over 5 years ago

  • Description updated (diff)
Actions

Also available in: Atom PDF

Like0
Like0Like0