I’m fairly new to OS X coding, and mashing together a bunch of things from other places to do some vision tracking. One of my needs right now is to create a new directory and spit out sequential frames to it as they are read and processed.
I have code to do this on a PC, but I’ve just spent a whole day trying to figure out OS X’s file handling stuff. Normal ‘fopen’, ‘fwrite’ etc. commands clearly don’t cut it in OS X. Anyone have a code snippet that can create a directory, take a normal char* filename and creates a file with that name to dump bytes to, then closes it?
also, Poco, which is a library that comes included with OF has great cross platform directory / file system code – here’s a short function that we had in a project and I’ve plugged it into the empty example .cpp file so you can see it in action when you press ‘a’:
i tried using the makeDirectory example and it works great.
i tried to use the copyFromTo and it seems to not work.
i had to comment out the doesFileExist() part to get it to work. see code below.
but if i use the doesFileExist() inside my testApp.cpp i get correct results. but inside your copyFromTo it seems to get false results.
(i am using osx)
i am using this to copy a .mov file from the data folder to a remote computer mounted (/Volumes/remoteComputer/folderToCopyTo). same behaviour with when a large file is copied locally.
when coping a file with the fileHelper the whole OF app comes to a halt until the file is done copying.
i tried putting the fileHelper::copyFromTo() in a different thread using the threadExample. same behaviour.
?
thx
update:
i am now using ofxRuiThread.h to help me with threading and it works now without freezing the main app.
i used the ofxRuiThread example and just pasted the file copying code i needed.
i am sure there is a proper way of threading all of the filehelper functions !?