Forum > WinCE
path finding
mangakissa:
I created a small application which is running a dataset. this dataset will be saved as a textfile.
When I using 'assign(F,'sample.txt') and my application runs on temp in wince, my file is saved in the root. But why? How do I find the temp directory or my documents or application directory on winCE with Lazarus?
taazz:
--- Code: ---function AppFolder:String;
begin
Result := ExtractFileDir(Application.ExeName);
end;
--- End code ---
That should work on all windows systems.
Mike.Cornflake:
GetTempDir doesn't look like it's got any OS specific calls (just requires Environment TEMP being defined...)
mangakissa:
winCE is not window specific. It doesn't use drive letters to combine. The Environment TEMP doesn't exists, because I created myself.
winCE has 4 mountpoints
- /
- application
- my documents
- windows (i'm not sure about this one, device is at the office)
I could try extractfiledir(), but that doesn't give me (for example) My documents\textfiles to copy the file into
rvk:
I think WinCE doesn't know the concept of "Working directory" so if you save a file without specifying the full path it won't end up in your "Program directory". (It's somewhere in here)
Could you try getting the full program-filename and derive the path to put before sample.txt?
--- Code: ---var
lpFileName: array[MAX_PATH+1] of Char;
begin
GetModuleFileName(NULL, lpFileName, MAX_PATH);
{...}
--- End code ---
Navigation
[0] Message Index
[#] Next page