OK, I finally got a project
mostly done, so I'm preparing to release (I'll announce it on this board so you all can
flame critique my programming skills).
I have a bit of a strange error on Windows, however. Take this piece of code, which writes a new configuration file if none is found
(PBConfig is defined as a TStringlist, and freed later in the code, CFGFile is a function that returns the result of GetAppConfigFile(false)):
procedure makeConfig;
begin
PBConfig := TStringList.Create;
PBConfig.Add('UserKey=');
PBConfig.Add('Format=0');
PBConfig.Add('Expire=0');
PBConfig.Add('Private=0');
PBConfig.SaveToFile(CFGFile);
end;
If I leave it as-is, I get a "Project pastequick raised exception class 'EFCreateError' with message: Unable to create file "C:\users\me\AppData\local\pastequick\pastequick.cfg""
No spaces in the path, so I couldn't really figure that out, then I thought "Maybe the error is due to it trying to write to a file that doesn't exist, so why don't I create the file first with FileCreate?"
Great idea, says /me
procedure makeConfig;
begin
FileCreate(CFGFile);
...
Same error, so now I do this:
procedure makeConfig;
begin
ForceDirectories(GetAppConfigDir(false));
FileCreate(CFGFile);
...
Now it's giving me an error that it can't read the file, but the file is created. The file that is created is 0 kb. ???
A second compile attempt gives the error:
"project pastequick raised exception class 'EConvertError' with message: "" is an invalid integer"
WTH?