02-09-2006 01:04 PM
02-09-2006 02:01 PM
You want to turn off library errors:
int oldState;
int result;
oldState=SetBreakOnLibraryErrors(0);
result=MakeDir(filepath);
SetBreakOnLibraryErrors(oldState);
The value of result will be -9 if the directory previously existed. If this is ok it can be treated as a successfull result.
If you know you will not be making a call to SetBreakOnLibraryErrors() before executing this routine you do not need to save the "old state" and can just bracket MakeDir() with SetBreakOnLibraryErrors(0) and SetBreakOnLibraryErrors(1) to disable error checking for this step.
02-09-2006 04:27 PM
Hi.
You could use the FileExists() function from Programmer's Toolbox.
Try this:
#include <toolbox.h>
int exists, size, error;
exists = FileExists ("mydir\\.", &size);
if (!exists)
error = MakeDir (“mydir”);
Using “mydir\\.” rather than “mydir” confirms that “mydir” is a folder, not just a regular file.
Regards,
Colin.
02-10-2006 07:15 AM
02-13-2006 08:17 AM
Hi,
I was wondering how i can go about changing the project directory to the new path once i hv created a new folder....say i get the project directory....then i check if a folder exists, if not create it and then i want that to be the default project directory path. i tried calling get project dir but doesnt seem to change the path.
I would appreciate if you could guide me through.
Thanks
k1_ke
02-13-2006 08:35 AM