Csound Csound-dev Csound-tekno Search About

[Cs-dev] Windows Path Problem

Date2007-01-06 15:36
From"Steven Yi"
Subject[Cs-dev] Windows Path Problem
AttachmentsNone  

Date2007-01-06 16:32
FromAnthony Kozar
SubjectRe: [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

Date2007-01-07 17:57
From"Steven Yi"
SubjectRe: [Cs-dev] Windows Path Problem
AttachmentsNone  

Date2007-01-07 18:39
FromAnthony Kozar
SubjectRe: [Cs-dev] Windows Path Problem
Thanks Steven!  I will give this a try.

Anthony

Steven Yi wrote on 1/7/07 12:57 PM:

> Thanks for your email reply.  I took the simple route and added a call
> to csoundConvertPathname in the top of csoundGetDirectoryForPath.  It
> now works for csound5gui at least, and running from commandline
> remains working.


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

Date2007-01-07 18:48
From"Steven Yi"
SubjectRe: [Cs-dev] Windows Path Problem
AttachmentsNone