Csound Csound-dev Csound-tekno Search About

Re: [Cs-dev] Windows Path Problem

Date2007-01-06 19:35
FromMichael Gogins
SubjectRe: [Cs-dev] Windows Path Problem
You are correct about the cause of the problem, as far as I know.

However, I think that the pathnames in Csound files and command lines should be platform-neutral as far as possible. Using '/' for a directory separator certainly does work on both Linux and Windows, as far as the respective operating systems are concerned.

Regards,
Mike

-----Original Message-----
>From: Anthony Kozar 
>Sent: Jan 6, 2007 11:32 AM
>To: Csound Developer list 
>Subject: Re: [Cs-dev] Windows Path Problem
>
>Hi Steven, 
>
>Sorry that I did not see this thread earlier -- I could have perhaps saved
>you some time.
>
>I believe Michael already traced the problem to the function
>csoundGetDirectoryForPath() in envvar.c.  This function only recognizes the
>native DIRSEP character for each platform.  I have not traced it on Windows
>to know exactly what the problem is but I am guessing that in a pathname
>with no '\\' in it, the variable lastIndex is getting set to some value that
>the rest of the code does not properly check for.
>
>Calling the function csoundConvertPathname() at the beginning of the
>function (even before the call to strrchr(path, DIRSEP)) should fix the
>problem on Windows I think.  But it seems strange to me to use the full
>pathname conversion facilities of that function on the orchestra and score
>paths since they should always be specified in the platform's native format.
>(I am still planning to do more changes to csoundConvertPathname() so that
>Unix, Windows, and MacOS paths can be freely converted between each other
>under all circumstances that make sense).
>
>We could use csoundConvertPathname() or just write another function
>csoundNormalizeWindowsPathname() that only converts '/' to '\\' and is only
>called on Windows.
>
>I will also note that there is an implicit assumption in
>csoundGetDirectoryForPath() that if (csoundIsNameFullpath(path)) is true,
>than path contains DIRSEP -- this is the root of the problem here I think.
>There are also implicit assumptions in csoundIsNameFullpath(),
>csoundIsNameRelativePath(), and csoundIsNameJustFilename() that only native
>DIRSEPs are in the path (this means no '/' on Windows).
>
>So either everyone must be careful to call csoundConvertPathname() before
>calling these functions (I made sure of this for the file opening functions
>which is why '/' is OK in the orchestra), or these functions should call
>either csoundConvertPathname() or csoundNormalizeWindowsPathname() -- which
>will be redundant in some places.
>
>I was planning to look into this myself over the weekend.  Thanks to Steven
>for grabbing the ball and running with it :)
>
>Anthony
>
>Steven Yi wrote on 1/6/07 10:36 AM:
>
>> Hi All,
>> 
>> For csound5gui, I ran with gdb and set breakpoints on functions that
>> Anthony wrote and none of them hit before csound5gui segfaulted.
>> Also, I wrote a test.csd file that had:
>> 
>> #include "c:/test.inc"
>> 
>> and also:
>> 
>> f1 0 262144 "c:/csound/samples/test.aif" 0 0 0
>> 
>> and Csound *can* parse and load those within a CSD file.  So, my guess
>> at the moment is that Anthony's changes are not the cause of the
>> segfaulting problem.  I am wondering though if the problem could be in
>> parsing the commandline args, but will stop here for the day and start
>> again tomorrow.
>
>
>
>-------------------------------------------------------------------------
>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
>https://lists.sourceforge.net/lists/listinfo/csound-devel




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