Csound Csound-dev Csound-tekno Search About

[Cs-dev] More path stuff

Date2006-11-27 01:15
FromAnthony Kozar
Subject[Cs-dev] More path stuff
Should ~/  (tilde-slash) be treated as an absolute path by Csound on
Unix-like systems?

Currently, the code will consider it relative and try to concatenate it, in
some cases giving paths like /path/to/ssdir/~/myfile.aiff.  (Which is
clearly wrong but generally harmless for now).

I just wasn't sure when writing/modifying csoundIsNameFullpath() and friends
whether it should be treated as absolute since the Unix books I have call ~/
a "relative path".

Is ~/ (or ~\) meaningful at all on Windows?  How should Csound on Windows
deal with a Unix path beginning with ~/ ?

Anthony Kozar
anthonykozar AT sbcglobal DOT net


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2006-11-27 08:44
Fromjpff
SubjectRe: [Cs-dev] More path stuff
The ~ format is usually expanded by the shell, on in emacs there is an
explicit function.  ~ is usually replaced by $HOME and ~xyz by home
directory of user xyz.
  So ~/ is an absolute address after expansion, and not before.
On Windows the concept of $HOME is weaker but not unknown
==John ffitch

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2006-11-27 10:31
FromRichard Dobson
SubjectRe: [Cs-dev] More path stuff
Indeed, the nearest equivalent defined by Windows is HOMEPATH, usually 
defined by default as something like "\Documents and Settings\Your Name".


This only usually matters when one launches a DOS console session, which 
then starts up in that directory. There is no other "obvious" standard 
directory to start up in in Windows. Users can of course change the path 
like any other environment variable, but even that is something that 
woudl be regarded by many users as an obscure "advanced" hack sort of 
thing to do. Normally, the home directory is whatever directory the 
selected GUI application starts up in, so in the absence of anything 
else a GUI version of Csound on Windows has the choice of either 
HOMEPATH, or its own installation folder. Windows users expect apps to 
remember the directory they were last set to, and start up in that 
directory the next time; this requires a simple procedure of storing the 
path either directly in the Registry , or in a WINSOUND.INI (or 
whatever) file, in either case by means of the appropriate Win32 API calls.


Richard Dobson





jpff wrote:
> The ~ format is usually expanded by the shell, on in emacs there is an
> explicit function.  ~ is usually replaced by $HOME and ~xyz by home
> directory of user xyz.
>   So ~/ is an absolute address after expansion, and not before.
> On Windows the concept of $HOME is weaker but not unknown
> ==John ffitch
> 
>



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2006-11-27 17:32
FromAnthony Kozar
SubjectRe: [Cs-dev] More path stuff
So will fopen("~/somefile", "r")  expand the pathname or does one have to
explicitly get the value of $HOME and concatenate it oneself?

What should Csound do if it encounters a path in the orchestra or score that
begins with ~/ ?

Anthony

jpff wrote on 11/27/06 3:44 AM:

> The ~ format is usually expanded by the shell, on in emacs there is an
> explicit function.  ~ is usually replaced by $HOME and ~xyz by home
> directory of user xyz.
> So ~/ is an absolute address after expansion, and not before.
> On Windows the concept of $HOME is weaker but not unknown
> ==John ffitch


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2006-11-27 18:41
Fromjpff
SubjectRe: [Cs-dev] More path stuff
fopen will not expand in C.  One has to code it
If there is a leading ~ then Linux/Unix/OSX would replace ~/ by
approximately strcat(getenv("HOME"),"/")
More complex, if ~abc/ is found then one needs to get the expansion
from /etc/passwd

==John ffitch

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2006-11-27 23:15
FromAnthony Kozar
SubjectRe: [Cs-dev] More path stuff
Thanks John (and Richard).

I am going to add support for interpreting ~/ paths later this week.  I
don't really know how to go about doing the ~abc/ style ones -- indeed, I
don't think I have ever seen them before -- so someone else should probably
do that when I am done if it is deemed important.

Anthony

jpff wrote on 11/27/06 1:41 PM:

> fopen will not expand in C.  One has to code it
> If there is a leading ~ then Linux/Unix/OSX would replace ~/ by
> approximately strcat(getenv("HOME"),"/")
> More complex, if ~abc/ is found then one needs to get the expansion
> from /etc/passwd


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net