|
On Jan 26, 2005, at 9:32 AM, Anthony Kozar wrote:
> Does tmpnam() give you paths in /tmp on OS X or does it just return a
> filename? I get a filename with no path on OS 9.
it just returns the file name. which ends up putting the temp file in
the working
directory. on OSX, the working directory defaults to the directory
where the
application is, and most users do not have write permission there. so
i used
to change the working directory to SFDIR upon launch, but people get
annoyed
with that, especially if they have something that is crashing, the temp
files
never get deleted and clutter up the SFDIR.
so i recently added the /tmp manually. which is nice as it is out of
sight and even if
csound doesnt delete them [ usually by crashing ] the temp files will
be deleted next
time the computer is rebooted.
but, the MAIN PROBLEM with using tmpnam is that it always starts with
the same
filename the first time it is called in a process, so if i am running 2
csound jobs at
once i am guaranteed to have the 2nd process overwrite the 1st's temp
files!
one solution i thought of is to create another
file that is not deleted that just stores a number and have csound
create its own
temp file name, incrementing the stored number each time and then
appending
that number to the new file name. this isnt a complete solution though
as you
still could have a race condition with multiple processes running.
there also still
might be file permission problems on OSX
>
> Be aware that if you use tmpfile() then Csound's remove_tmpfiles code
> will
> no longer be needed. However, I would find this inconvenient since I
> sometimes rely on those files not being deleted until I quit Perf so
> that I
> can examine them when hunting for problems. I was hoping to add a
is this as a user or as a programmer? i dont think most users really
want
this. there is of course there is the -t0 option to use score.srt
instead, although
is this automatically deleted too?
> --keep-temp-files option too to skip the remove_tmpfiles code. But
> this
> would not be possible with tmpfile().
>
> Also, my docs say that tmpfile() opens a binary file. I don't know if
> that
> makes any difference. (Most of the temporary files in Csound are text
> are
> they not)?
oh that might be a problem...
-m
>
> Anthony
>
> On 1/25/05 10:33 PM, Matt Ingalls etched in
> stone:
>
>> this is the kind of problem that i was predicting a couple weeks back.
>> with the "temp files" post
>>
>> i think we should replace all tmpnam() calls with tmpfile() -- at
>> least
>> this
>> would prevent multiple users and/or multiple processes trying to
>> create
>> the
>> same file. if it is true that a 'regular' user cant create files in
>> /tmp anyway
>> on OSX then i will have to have it write the files somewhere in user's
>> space..
>>
>> -m
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
> Tool for open source databases. Create drag-&-drop reports. Save time
> by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
> Download a FREE copy at http://www.intelliview.com/go/osdn_nl
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>
-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net |