[PD] textfile bug/idiosyncracies (load/save console messages)

ClaudiusMaximus gloriousclaudiusmaximus at yahoo.co.uk
Mon Jun 21 12:46:06 CEST 2004


I tried some reading and writing of files with [textfile].



Reading file:

"""
tried
/home/claude/workinprogress/copyme/gravity/patches/../data/cm_g_kicker-0000.reservoir and succeeded
"""

This works as I think it should, some feedback on file IO.

An even better way of getting feedback would be an extra [textfile]
outlet that outputs [read 0( or [read 1( depending on whether the file
loaded successfully or not, perhaps with the absolute path name - that
way the patch knows if it worked, rather than just the console-watching
user knowing, and help catch bugs with relative paths and patches in
different directories etc.  Feedback at the point of error.

I think there should still be console output, but perhaps saying "tried
to read" instead of just "tried" - tried what?



Reading non-existent file:

"""
tried
/home/claude/workinprogress/copyme/gravity/patches/../data/cm_g_kicker-0067.eveloop and failed
tried /usr/lib/pd/extra/../data/cm_g_kicker-0067.eveloop and failed
error: ../data/cm_g_kicker-0067.eveloop: can't open
error: ../data/cm_g_kicker-0067.eveloop: read failed
"""

Two "error:" messages seems a little redundant.



Writing file successfully:

"""
"""

No output - no way of knowing if the file was written successfully,
except maybe using [shell] to get a directory listing.

I think console output like "tried to write [absolute path] and
succeeded/failed" would be useful, and the outlet for success/failure
outputting [write 0( or [write 1(, for the reasons above.



Writing empty file successfully:

"""
error: ../data/cm_g_kicker-0000.reservoir: write failed
"""

This is a bug.  The file is written to disk successfully (all 0 bytes
without errors).  Reading the 0 byte file works like any other file
reading, if successful it clears the [textfile].  It is only the console
message that is wrong.






More information about the Pd-list mailing list