help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Home directory in octave on windows?


From: m h
Subject: Re: Home directory in octave on windows?
Date: Thu, 4 Jun 2009 17:58:49 -0700 (PDT)

Thanks Michael and Tatsuro. Very interesting. The tip with the HOMEDRIVE variable is what got me going.

So I figured out what was going on:

Upon startup, there's no HOME variable in the environment that my Octave starts up in.
And, somewhere in my user profile, apparently someone set up U: as my home drive (i.e. the HOMEDRIVE variable). This is apparent when I open up a regular cmd command shell, and type "echo %HOMEDRIVE%". (As an aside, I haven't figured out where that variable gets set, it's not in the registry (regedit) or in the Computer/Properties/Advanced System Settings/Environment Variables ... Must have been set somewhere else...)

C:\Users>echo %HOMEDRIVE%
U:


So for now, I'm stuck with reading an .octaverc in the U: directory. So I used that and set up and .octaverc to change the HOME, HOMEDRIVE and HOMEPATH variables. That seemed to work. Interestingly enough, now Octave reads the .octaverc in the U:\ directory, and then the .octaverc in the new HOME path I set. Both get read! Example:

Content of U:\.octaverc :

printf("HOME before set: %s\n", getenv('HOME'));
printf("HOMEDRIVE before set: %s\n", getenv('HOMEDRIVE'));
printf("HOMEPATH before set: %s\n", getenv('HOMEPATH'));
setenv('HOME','C:\Users')
setenv('HOMEDRIVE','C:')
setenv('HOMEPATH','C:\Users')
printf("HOME now changed to: %s\n", getenv('HOME'));
printf("HOMEDRIVE now changed to: %s\n", getenv('HOMEDRIVE'));
printf("HOMEPATH now changed to: %s\n", getenv('HOMEPATH'));
printf("%s\n","Read .octaverc at U:")
cd

Content of C:\Users\.octaverc

printf("%s\n","Read .octaverc at C:\\Users")

Output when Ocave starts:

[...]
For information about changes from previous versions, type `news'.

HOME before set:
HOMEDRIVE before set: U:
HOMEPATH before set: \
HOME now changed to: C:\Users
HOMEDRIVE now changed to: C:
HOMEPATH now changed to: C:\Users
Read .octaverc at U:
Read .octaverc at C:\Users
octave-3.0.5.exe:1:~
>


I used C:\Users as a test directory, I'll change that of course for real work...
If you have any idea how to look for where else (other than the two locations I mentioned above) my HOMEDRIVE variable could get set, I'd appreciate any information. But that's really a Windows question... Otherwise, I can work with the situation as is.

Thanks for all the help!

--- Marc



From: Michael Goffioul <address@hidden>
To: address@hidden
Cc: m h <address@hidden>; address@hidden
Sent: Wednesday, June 3, 2009 12:53:03 AM
Subject: Re: Home directory in octave on windows?

Under Windows, the home directory is computed using
2 methods:

1) HOME variable
2) HOMEDRIVE and HOMEPATH variables

The first method takes precedence.

Michael.


On Wed, Jun 3, 2009 at 8:07 AM, Tatsuro MATSUOKA <address@hidden> wrote:
> Hello
>
> HMMMMMMM ????
>
> In my case,
>
> I added
>
> putenv('HOME','D:\usr')
>
> in the last line of
> C:\Programs\Octave\3.0.5_gcc-4.3.0\share\octave\3.0.5\m\startup\octaverc
>
> and start octave
>
>> tilde_expand ('~')
> ans = D:\usr
>
> Then I changed the last line to
>
> putenv('HOME','D:\usr\tatsu')
>
> and quited octave and restarted octave
>
>> tilde_expand ('~')
> ans = D:\usr\tatsu
>
> As written the above, in my case putenv('HOME',(folder path)) worked well to change '~'..
>
> This is what I did when I wrote the previous post.
>
> Note My os is windows xp pro sp3 and I log on as an administrator.
>
> Regards
>
> Tatsuro
>
>
>
> --- m h  wrote:
>
>> Tatsuro, thanks for the suggestions.
>>
>> Here is what I tried:
>> I disconnected the U: drive, to see what would happen. Then I started the octave.exe file (the
>> normal way, double clicking on the file in Windows explorer). After startup, here's what
>> happens:
>>
>> -----------------------------------
>>
>> > tilde_expand("~")
>> ans = U:\
>> octave.exe:2:C:\Program Files (x86)\Octave\3.0.5_gcc-4.3.0\bin
>> > getenv("HOME")
>> ans =
>> octave.exe:3:C:\Program Files (x86)\Octave\3.0.5_gcc-4.3.0\bin
>> > ls ~
>> The system cannot find the path specified.
>> error: ls: command exited abnormally with status 127
>> error: evaluating if command near line 59, column 7
>> error: evaluating if command near line 55, column 5
>> error: evaluating if command near line 49, column 3
>> error: called from `ls' in file `C:\Program Files (x86)\Octave\3.0.5_gcc-4.3.0\s
>> hare\octave\3.0.5\m\miscellaneous\ls.m'
>> octave.exe:3:C:\Program Files (x86)\Octave\3.0.5_gcc-4.3.0\bin
>> >
>>
>> -----------------------------------
>>
>> The last command happened because U:\ no longer exists (I disconnected the network drive).
>> So ~ and HOME seem to be two different things. And Octave insists on creating (if it doesn't
>> already exist) a new .octaverc in the ~ directory , not the HOME directory.
>>
>> Any idea what's going on? How does Octave determine what the ~ directory is in Windows? It's
>> apparently not the HOME directory.
>>
>> Thanks,
>>
>> --- Marc
>>
>>
>>
>> ________________________________
>> From: Tatsuro MATSUOKA <address@hidden>
>> To: address@hidden; m h <address@hidden>; address@hidden
>> Sent: Thursday, May 28, 2009 6:44:04 PM
>> Subject: Re: Home directory in octave on windows?
>>
>> Hello
>>
>> I have remembered the other way
>>
>> Please write the below
>>
>> putenv('HOME','D:\usr')
>>
>> (octave-home) /share/octave/site/m/startup/octaverc or
>> (octave-home) /share/octave/version/m/startup/octaverc
>>
>> Perhaps this way is smart than that I have show in previous post.
>>
>> Regards
>>
>> Tatsuro
>>
>> --- Tatsuro MATSUOKA < wrote:
>>
>> > Hello
>> >
>> > I have mislead.
>> >
>> > Please set environment variable 'HOME' in the windows.
>> >
>> > In my case HOME is set to 'D:\usr\tatsu'
>> > > ls ~
>> >  Volume in drive D has no label.
>> >  Volume Serial Number is ACCF-78A8
>> >
>> >  Directory of D:\usr\Tatsu
>> >
>> >
>> > For the way to set environment variables, please see:
>> > http://lifehacker.com/259018/
>> > Create your own environment variables for quick folder navigation
>> >
>> > Regards
>> >
>> > Tatsuro
>> >
>> > --- m h wrote:
>> >
>> > > I'm running Octave-3.0.5 on a WinVista machine.
>> > >
>> > > Right now, it seems that octave insists that my home directory
>> > > (whatever that means on windows), i.e. the directory that is listed when
>> > > I type "ls ~", is a network drive that my computer is connected to,
>> > > specifically a drive that's mounted as U: . This also unfortunately means my
>> > > .octaverc file, log file, etc, get created and written to the root directory of U:
>> > > . I'd like that to be somewhere else.
>> > >
>> > > How do I change where octave thinks the home directory is? Can I tell
>> > > it to look for a .octaverc file (and store log files) somewhere else?
>> > > Or is that hard coded into the executable that I download?
>> > >
>> > > Thanks...
>> > >
>> > > --- Marc
>> > >
>> > >
>> > >
>> > >       > _______________________________________________
>> > > Help-octave mailing list
>> > > address@hidden
>> > > https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
>> > >
>> >
>> >
>> > --------------------------------------
>> > Power up the Internet with Yahoo! Toolbar.
>> > http://pr.mail.yahoo.co.jp/toolbar/
>> > _______________________________________________
>> > Help-octave mailing list
>> > address@hidden
>> > https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
>> >
>>
>>
>> --------------------------------------
>> Power up the Internet with Yahoo! Toolbar.
>> http://pr.mail.yahoo.co.jp/toolbar/
>>
>>
>>
>>
>
>
> --------------------------------------
> Power up the Internet with Yahoo! Toolbar.
> http://pr.mail.yahoo.co.jp/toolbar/
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]