Loading configuration files in an OS-agnostic way

From: Pit Capitain [mailto:pit@capitain.de]
Subject: Re: Loading configuration files in an OS-agnostic way

At least on Win 2000, you can't create such a file in the
Windows Explorer, but
you sure can in Ruby:

   File.open ".google_key", "w" do |out| out.puts "# config" end

But this doesn't solve the problem because the user should be able to create and swap configuration files using the default shell.

Thanks for the info though. I didn't know that Windows allowed filenames with a period in front.

gavri

···

---------------------------------------------------------------------------------------------
This message, including any attachments, contains confidential information intended for a specific individual and purpose, and is intended for the addressee only. Any unauthorized disclosure, use, dissemination, copying, or distribution of this message or any of its attachments or the information contained in this e-mail, or the taking of any action based on it, is strictly prohibited. If you are not the intended recipient, please notify the sender immediately by return e-mail and delete this message.

"But this doesn't solve the problem because the user should be able to
create and swap configuration files using the default shell."

The shell works. Only Explorer is broken.

c:\> echo foo > .bar
c:\> dir

FYI, .cpan directories work fine from Perl too.

--Michael

···

On Fri, 17 Dec 2004 17:24:26 +0900, Gavri Savio Fernandez <gavrif@virtusa.com> wrote:

> From: Pit Capitain [mailto:pit@capitain.de]
> Subject: Re: Loading configuration files in an OS-agnostic way

> At least on Win 2000, you can't create such a file in the
> Windows Explorer, but
> you sure can in Ruby:
>
> File.open ".google_key", "w" do |out| out.puts "# config" end
>

But this doesn't solve the problem because the user should be able to create and swap configuration files using the default shell.

Thanks for the info though. I didn't know that Windows allowed filenames with a period in front.

gavri

---------------------------------------------------------------------------------------------
This message, including any attachments, contains confidential information intended for a specific individual and purpose, and is intended for the addressee only. Any unauthorized disclosure, use, dissemination, copying, or distribution of this message or any of its attachments or the information contained in this e-mail, or the taking of any action based on it, is strictly prohibited. If you are not the intended recipient, please notify the sender immediately by return e-mail and delete this message.

Gavri Savio Fernandez wrote:

But this doesn't solve the problem because the user should be able to create and swap configuration files using the default shell.

Windows File Explorer is anal about this, but in a cmd.exe window one can create a .foo file by calling an editor (well, gvim, at least)

C:\Temp>gvim .foo

Then edit and save the new file.

You can also copy a file to a new file with a dot-leading name. And rename files to .foo, too.

The CLI rules. Even on Windows.

James

James Britt wrote:

Windows File Explorer is anal about this, but in a cmd.exe window one can create a .foo file by calling an editor (well, gvim, at least)

C:\Temp>gvim .foo

Then edit and save the new file.

You can also copy a file to a new file with a dot-leading name. And rename files to .foo, too.

The CLI rules. Even on Windows.

Have you tried quoting the filename? I know that works for names with
blank spaces in them... e.g.,

    copy "my file.txt" other.txt

I wouldn't be surprised if

    copy foo ".foo"

also worked...

Hal

Hal Fulton wrote:

Have you tried quoting the filename? I know that works for names with
blank spaces in them... e.g.,

   copy "my file.txt" other.txt

I wouldn't be surprised if

   copy foo ".foo"

No need for the quotes there.

c:\>copy foo .foo
         1 file(s) copied.

But you will need them for file names with spaces.

James