On Sunday, 17 June 2012 at 22:39:00 UTC, Stephen Jones wrote:
I recently switched from Eclipse to monoD and found that all my code to images etc was invalid because getcwd returns the directory that contains the main entry code in Eclipse, but returns the directory that contains the executable in MonoDevelop. Is there a universally consistent way of accessing files?

As mentioned, it is not reliable to use the current working directory for making a relative path absolute.

The approach I use is GetModuleFileNameA on Windows (GetModuleFileNameA(null, Buffer.ptr, MAX_PATH)) and readLinkPosix for /proc/self/exe on Linux (readLinkPosix("/proc/self/exe", Buffer.ptr, Buffer.length)).

Reply via email to