Forum > General
Create files without lunching the program as superuser
Sora-Kun:
Hello,
I'm asking this question for those who know Linux systems :D
Please, when I lunch my program created in Lazarus, and my program create files in some directories, while creating these files, I receive an error message saying "Unable to create file '........../..../...py' " note that I use the command "MemoX.Savetofile('xxxxxxxx/xxxx/xx.py')"
Please HELP :'(
Thanks
Bart:
--- Quote from: Linkos on June 28, 2010, 06:49:52 am ---Hello,
I'm asking this question for those who know Linux systems :D
Please, when I lunch my program created in Lazarus
--- End quote ---
Only at lunch, or also at dinner? :)
--- Quote from: Linkos on June 28, 2010, 06:49:52 am ---and my program create files in some directories,
--- End quote ---
What directory? Please specify.
--- Quote from: Linkos on June 28, 2010, 06:49:52 am --- while creating these files, I receive an error message saying "Unable to create file '........../..../...py' " note that I use the command "MemoX.Savetofile('xxxxxxxx/xxxx/xx.py')"
--- End quote ---
Please quote the exact error message.
Do I understand correctly that the filename in the errormessage is different from the filename specified in the code?
What value does GetLastOSError return?
Bart
Sora-Kun:
Hello, i didn't eat my breakfast, that's why I make some writing mistakes :D
Any way, Here is the thing, in my program µ.dev, when the user launch the code, my program creates the next file: GetAppConfigDir(True)+'file.py'
here is the full code: pypath := Memo1.Text;
SynEdit1.Lines.SaveToFile(temp1);
SynEdit1.BlockBegin:= SynEdit1.CaretXY;
if not (pypath = '') then
begin
if aa = false then
begin
Process1.CommandLine:= pypath + ' '+temp1;
Process1.Execute;
end
else
Process1.CommandLine:= temp1;
Process1.Execute;
end
else
MessageDlg('No Python path selected',mtCustom, [mbOK], 0);
end;
When i press the "Launch" button I receive the next error message: «Unable to create file "etc/u.dev/file.py" press OK to ignore the risk data corruption Press Cancel to quit the program»
I'm under Ubuntu 10.2
Please HELP %)
Laksen:
GetAppConfigDir(true) returns the global dir for application configuration files. You generally need elevated privileges to write in this directory in all operating systems
What you probably want is either a temp dir(GetTempDir/GetTempFileName) or the user local application config directory(GetAppConfigDir(false))
Sora-Kun:
Thanks , and this meen that there is no way to solve my probleme but launch the program as super-user :-\ ...
Navigation
[0] Message Index
[#] Next page