osx yosemite fpc, lazarus svn qt x64
ParamStrUTF8(0) in /lazarus/components/lazutils/fileutil.pas this function result in osx : ......./myproject.app/Contents/MacOS/myproject showing normal, but its symbolink link, not application. Why I need real application path, I need create some folder and create ini files in application's same folder.
In osx myproject.app is a folder, and finder show it like a application, so end user not find and access to that created folder and ini files. I need real application path. How to do this?
thank you.
Mailing lists / lazarus / 2015-02
need suggestion about ParamStrUTF8(0)
7 messages · 3 people ·
- FFreeMan 4
- MMattias Gaertner 2
- SSchindler Karl-Michael 1
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
osx yosemite fpc, lazarus svn qt x64 ParamStrUTF8(0) in /lazarus/components/lazutils/fileutil.pas this function result in osx : ......./myproject.app/Contents/MacOS/myproject showing normal, but its symbolink link, not application.
When deploying your application you can remove the symbolic link and move the binary into that folder.
Eventually Lazarus will put the binary into the folder.
Show quoted text 5 lines
Although the Finder does not show the contents of this folder by default, programs can read and write there normally. You can store ini files there.
If you want the user to see your ini files in Finder, then you should create a normal directory. As far as I know there is no standard for that.
Mattias
Show quoted text 32 lines
Maybe I misunderstand some details, but i understand the Apple Human Interface Guidelines that preference files should be put in ~/Library/Preferences for user specific preferences and in /Library/Preferences for global ones. Other files can be kept within the .app bundle, in particular if they should be replaced by a new installation or update and unless they should survive an update of the program. In the later case they should be placed in ~/Library/Application Support/NAME_OF_YOUR_PROGRAM or /Library/Application Support/NAME_OF_YOUR_PROGRAM if they are global. Simillarly, log files should be placed in ~/Library/Logs/NAME_OF_YOUR_PROGRAM or /Library/Logs/NAME_OF_YOUR_PROGRAM. For further details read here:
Michael.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 496 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20150217/f3a33e56/attachment.bin>
Yes, this can not be standart but, for me useful. Why, My application work with database, on first run, no any db created. On my login screen have create db form, user can create more db files. year by year or what they want. When db create many settings added on create. user permission etc. So I have to set db files folder some where. In win and linux same folder with application.
and some time need to help to user, first job get backup data, if all files be in /applications/myproject.app/.... folder, they have to just copy all of them, xx gb can be, data folder used change. some time just one db has a problem and tey want to sent me ? can do on terminal of course, but how to tell this to blonde stuff on telephone :) usually I create partition or volume, and use my application and data from there. And for backup, show to user this folder is all your data, just copy out of this computer where you want. so I any on broke system I'm not get risk.
{$IFDEF UNIX}
S := ParamStrUTF8(0);
//CheckIfFileIsSymlink(S); I wish, this be a function and result be
is fpReadLink, 'cos its in :)
FileAttr := FileGetAttr(S);
if(FileAttr and faSymLink)>0then S := fpReadLink(S)
else s:= 'normal file';
{$ENDIF}Schindler Karl-Michael wrote 26 lines
This is my solution, this function's job is: If parameter AFilename is symbolic link, get it's target path, and "../" symbols remove and result set to link's target path.
this function useful for unix based system, I tested just osx. Can it add in main source utils of lazarus ?
function GetTargetIfFileIsSymlink(const AFilename: string): string;
var FileAttr: LongInt;
I, J : Integer;
begin
Result := '';
if not FileExistsUTF8(AFilename) then begin
raise Exception.Create(Format(lrsFileDoesNotExist, [AFilename]));
end;
FileAttr := FileGetAttr(AFilename);
if(FileAttr and faSymLink)=0then Result := ExtractFilePath(AFilename)
else begin
Result := fpReadLink(AFilename);
with TStringList.Create do
begin
Delimiter := DirectorySeparator;
DelimitedText := Result;
J := 0;
for I:=0 to Count -1 do
if Strings[I]='..'then inc(J);
if J>0then begin
DelimitedText := ExtractFilePath(AFilename);
while (J>0) and (Count>0) do begin
Delete(Count-1);
Dec(J);
end;
end;
Result := DelimitedText;
Free;
end;
end;
end;FreeMan wrote 9 lines
Show quoted text 5 lines
The function is very specific to your environment.
Mattias
Its just a bit, no problem.
Mattias Gaertner wroteThe function is very specific to your environment. Mattias
