[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: Loading configuration files in an OS-agnostic way

Gavri Savio Fernandez

12/17/2004 8:24:00 AM


> 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.



4 Answers

Michael DeHaan

12/17/2004 5:36:00 PM

0

"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.
>
>


James Britt

12/18/2004 8:38:00 PM

0

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


Hal E. Fulton

12/18/2004 8:52:00 PM

0

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



James Britt

12/18/2004 9:16:00 PM

0

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