Open brickviking opened 2 years ago
At least on MS-DOS-like systems (including FreeDOS here) you could use LFN, but only if it's supported. On places where LFN isn't immediately available, you're stuck with simply calling it list.dbg to get the same usable concept underneath them.
You could try this, at least when fenced by #ifdef:
...
20: if(NULL == fi->BugWriteFName) {
21: if(!getenv("TEMP")) /* Whoops, no TEMP variable defined */
22:-- strcpy(TempPath, "/tmp/list.debug"); /* This should be the last resort filename, not the default */
22:++ strcpy(TempPath, "/tmp/list.dbg"); /* This should be the last resort filename, not the default */
23: else {
24: /* Should this be a file in the users home dir instead? The only place where this
25: * wouldn't work is where the home dir is not writeable.
26: */
27 strcpy(TempPath, getenv("TEMP")); /* Else, we found a candidate dir to use */:
28:-- sprintf(TempPath + (strlen(TempPath) + 1), "list.debug"); /* lets hope this is the right length */
28:++ sprintf(TempPath + (strlen(TempPath) + 1), "list.dbg"); /* lets hope this is the right length */
29: }
30: }
...
One of the only other problems to solve with that #ifdef is: how do we find out if LFN is: 1) supported? 2) active at runtime?
This might properly be a #ifndef instead (i.e. #ifndef LFN, however that turns up), but we don't know that at run time, and it's no use at compile time, which is when #ifdef/#ifndef is commonly checked. How's it done during run time? Env vars?
Given this project started off as a DOS program, trying to create list.debug in the temp directory would have failed for the DOS platform. Perhaps this should be looked at.
list.c:28: