mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-20 18:19:10 +02:00
lazutils: GetAppConfigDirUTF8, GetAppConfigFileUTF8: added parameter to automatically create the directory
git-svn-id: trunk@37803 -
This commit is contained in:
parent
0200ab2e5b
commit
3e69cb14b1
@ -147,14 +147,25 @@ begin
|
|||||||
Result:=ConsoleToUTF8(SysUtils.GetEnvironmentVariable(UTF8ToSys(EnvVar)));
|
Result:=ConsoleToUTF8(SysUtils.GetEnvironmentVariable(UTF8ToSys(EnvVar)));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function GetAppConfigDirUTF8(Global: Boolean): string;
|
function GetAppConfigDirUTF8(Global: Boolean; Create: boolean = false): string;
|
||||||
begin
|
begin
|
||||||
Result:=SysToUTF8(SysUtils.GetAppConfigDir(Global));
|
Result:=SysToUTF8(SysUtils.GetAppConfigDir(Global));
|
||||||
|
if Result='' then exit;
|
||||||
|
if Create and not ForceDirectoriesUTF8(Result) then
|
||||||
|
raise EInOutError.Create(Format(lrsUnableToCreateConfigDirectoryS,[Result]));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function GetAppConfigFileUTF8(Global: Boolean; SubDir: boolean): string;
|
function GetAppConfigFileUTF8(Global: Boolean; SubDir: boolean;
|
||||||
|
CreateDir: boolean): string;
|
||||||
|
var
|
||||||
|
Dir: string;
|
||||||
begin
|
begin
|
||||||
Result:=SysToUTF8(SysUtils.GetAppConfigFile(Global,SubDir));
|
Result:=SysToUTF8(SysUtils.GetAppConfigFile(Global,SubDir));
|
||||||
|
if not CreateDir then exit;
|
||||||
|
Dir:=ExtractFilePath(Result);
|
||||||
|
if Dir='' then exit;
|
||||||
|
if not ForceDirectoriesUTF8(Dir) then
|
||||||
|
raise EInOutError.Create(Format(lrsUnableToCreateConfigDirectoryS,[Dir]));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function SysErrorMessageUTF8(ErrorCode: Integer): String;
|
function SysErrorMessageUTF8(ErrorCode: Integer): String;
|
||||||
|
@ -233,8 +233,9 @@ function FileCreateUTF8(Const FileName : string; Rights: Cardinal) : THandle; ov
|
|||||||
function ParamStrUTF8(Param: Integer): string;
|
function ParamStrUTF8(Param: Integer): string;
|
||||||
function GetEnvironmentStringUTF8(Index: Integer): string;
|
function GetEnvironmentStringUTF8(Index: Integer): string;
|
||||||
function GetEnvironmentVariableUTF8(const EnvVar: string): String;
|
function GetEnvironmentVariableUTF8(const EnvVar: string): String;
|
||||||
function GetAppConfigDirUTF8(Global: Boolean): string;
|
function GetAppConfigDirUTF8(Global: Boolean; Create: boolean = false): string;
|
||||||
function GetAppConfigFileUTF8(Global: Boolean; SubDir: boolean = false): string;
|
function GetAppConfigFileUTF8(Global: Boolean; SubDir: boolean = false;
|
||||||
|
CreateDir: boolean = false): string;
|
||||||
|
|
||||||
// other
|
// other
|
||||||
function SysErrorMessageUTF8(ErrorCode: Integer): String;
|
function SysErrorMessageUTF8(ErrorCode: Integer): String;
|
||||||
|
@ -9,15 +9,22 @@ msgstr ""
|
|||||||
"MIME-Version: 1.0\n"
|
"MIME-Version: 1.0\n"
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
|
||||||
#: lazutilsstrconsts.rsmodified
|
#: lazutilsstrconsts.lrsinvalidcharset
|
||||||
msgid " modified "
|
msgctxt "lazutilsstrconsts.lrsinvalidcharset"
|
||||||
msgstr "geändert"
|
|
||||||
|
|
||||||
#: lazutilsstrconsts.rssize
|
|
||||||
msgid " size "
|
|
||||||
msgstr "Größe"
|
|
||||||
|
|
||||||
#: lazutilsstrconsts.sinvalidcharset
|
|
||||||
msgid "The char set in mask \"%s\" is not valid!"
|
msgid "The char set in mask \"%s\" is not valid!"
|
||||||
msgstr "Der Zeichensatz in Maske \"%s\" ist ungültig!"
|
msgstr "Der Zeichensatz in Maske \"%s\" ist ungültig!"
|
||||||
|
|
||||||
|
#: lazutilsstrconsts.lrsmodified
|
||||||
|
msgctxt "lazutilsstrconsts.lrsmodified"
|
||||||
|
msgid " modified "
|
||||||
|
msgstr "geändert"
|
||||||
|
|
||||||
|
#: lazutilsstrconsts.lrssize
|
||||||
|
msgctxt "lazutilsstrconsts.lrssize"
|
||||||
|
msgid " size "
|
||||||
|
msgstr "Größe"
|
||||||
|
|
||||||
|
#: lazutilsstrconsts.lrsunabletocreateconfigdirectorys
|
||||||
|
msgid "Unable to create config directory \"%s\""
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
@ -1,15 +1,22 @@
|
|||||||
msgid ""
|
msgid ""
|
||||||
msgstr "Content-Type: text/plain; charset=UTF-8"
|
msgstr "Content-Type: text/plain; charset=UTF-8"
|
||||||
|
|
||||||
#: lazutilsstrconsts.rsmodified
|
#: lazutilsstrconsts.lrsinvalidcharset
|
||||||
msgid " modified "
|
msgctxt "lazutilsstrconsts.lrsinvalidcharset"
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: lazutilsstrconsts.rssize
|
|
||||||
msgid " size "
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: lazutilsstrconsts.sinvalidcharset
|
|
||||||
msgid "The char set in mask \"%s\" is not valid!"
|
msgid "The char set in mask \"%s\" is not valid!"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: lazutilsstrconsts.lrsmodified
|
||||||
|
msgctxt "lazutilsstrconsts.lrsmodified"
|
||||||
|
msgid " modified "
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lazutilsstrconsts.lrssize
|
||||||
|
msgctxt "lazutilsstrconsts.lrssize"
|
||||||
|
msgid " size "
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lazutilsstrconsts.lrsunabletocreateconfigdirectorys
|
||||||
|
msgid "Unable to create config directory \"%s\""
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
@ -9,15 +9,22 @@ msgstr ""
|
|||||||
"MIME-Version: 1.0\n"
|
"MIME-Version: 1.0\n"
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
|
||||||
#: lazutilsstrconsts.rsmodified
|
#: lazutilsstrconsts.lrsinvalidcharset
|
||||||
msgid " modified "
|
msgctxt "lazutilsstrconsts.lrsinvalidcharset"
|
||||||
msgstr " modificado"
|
|
||||||
|
|
||||||
#: lazutilsstrconsts.rssize
|
|
||||||
msgid " size "
|
|
||||||
msgstr " tamanho"
|
|
||||||
|
|
||||||
#: lazutilsstrconsts.sinvalidcharset
|
|
||||||
msgid "The char set in mask \"%s\" is not valid!"
|
msgid "The char set in mask \"%s\" is not valid!"
|
||||||
msgstr "Conjunto de caracteres na máscara \"%s\" inválido!"
|
msgstr "Conjunto de caracteres na máscara \"%s\" inválido!"
|
||||||
|
|
||||||
|
#: lazutilsstrconsts.lrsmodified
|
||||||
|
msgctxt "lazutilsstrconsts.lrsmodified"
|
||||||
|
msgid " modified "
|
||||||
|
msgstr " modificado"
|
||||||
|
|
||||||
|
#: lazutilsstrconsts.lrssize
|
||||||
|
msgctxt "lazutilsstrconsts.lrssize"
|
||||||
|
msgid " size "
|
||||||
|
msgstr " tamanho"
|
||||||
|
|
||||||
|
#: lazutilsstrconsts.lrsunabletocreateconfigdirectorys
|
||||||
|
msgid "Unable to create config directory \"%s\""
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
@ -9,15 +9,22 @@ msgstr ""
|
|||||||
"MIME-Version: 1.0\n"
|
"MIME-Version: 1.0\n"
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
|
||||||
#: lazutilsstrconsts.rsmodified
|
#: lazutilsstrconsts.lrsinvalidcharset
|
||||||
msgid " modified "
|
msgctxt "lazutilsstrconsts.lrsinvalidcharset"
|
||||||
msgstr " изменён "
|
|
||||||
|
|
||||||
#: lazutilsstrconsts.rssize
|
|
||||||
msgid " size "
|
|
||||||
msgstr " размер "
|
|
||||||
|
|
||||||
#: lazutilsstrconsts.sinvalidcharset
|
|
||||||
msgid "The char set in mask \"%s\" is not valid!"
|
msgid "The char set in mask \"%s\" is not valid!"
|
||||||
msgstr "Набор символов в маске \"%s\" некорректен!"
|
msgstr "Набор символов в маске \"%s\" некорректен!"
|
||||||
|
|
||||||
|
#: lazutilsstrconsts.lrsmodified
|
||||||
|
msgctxt "lazutilsstrconsts.lrsmodified"
|
||||||
|
msgid " modified "
|
||||||
|
msgstr " изменён "
|
||||||
|
|
||||||
|
#: lazutilsstrconsts.lrssize
|
||||||
|
msgctxt "lazutilsstrconsts.lrssize"
|
||||||
|
msgid " size "
|
||||||
|
msgstr " размер "
|
||||||
|
|
||||||
|
#: lazutilsstrconsts.lrsunabletocreateconfigdirectorys
|
||||||
|
msgid "Unable to create config directory \"%s\""
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
# Igor Paliychuk <mansonigor@gmail.com>, 2012.
|
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"PO-Revision-Date: 2012-04-23 10:30+0300\n"
|
"PO-Revision-Date: 2012-04-23 10:30+0300\n"
|
||||||
@ -6,18 +5,25 @@ msgstr ""
|
|||||||
"Language: uk\n"
|
"Language: uk\n"
|
||||||
"Content-Type: text/plain; charset=UTF-8\n"
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%"
|
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
|
||||||
"10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
|
|
||||||
"X-Generator: Virtaal 0.7.1\n"
|
"X-Generator: Virtaal 0.7.1\n"
|
||||||
|
|
||||||
#: lazutilsstrconsts.rsmodified
|
#: lazutilsstrconsts.lrsinvalidcharset
|
||||||
|
msgctxt "lazutilsstrconsts.lrsinvalidcharset"
|
||||||
|
msgid "The char set in mask \"%s\" is not valid!"
|
||||||
|
msgstr "Невірний набір символів по масці \"%s\"!"
|
||||||
|
|
||||||
|
#: lazutilsstrconsts.lrsmodified
|
||||||
|
msgctxt "lazutilsstrconsts.lrsmodified"
|
||||||
msgid " modified "
|
msgid " modified "
|
||||||
msgstr " змінено "
|
msgstr " змінено "
|
||||||
|
|
||||||
#: lazutilsstrconsts.rssize
|
#: lazutilsstrconsts.lrssize
|
||||||
|
msgctxt "lazutilsstrconsts.lrssize"
|
||||||
msgid " size "
|
msgid " size "
|
||||||
msgstr " розмір "
|
msgstr " розмір "
|
||||||
|
|
||||||
#: lazutilsstrconsts.sinvalidcharset
|
#: lazutilsstrconsts.lrsunabletocreateconfigdirectorys
|
||||||
msgid "The char set in mask \"%s\" is not valid!"
|
msgid "Unable to create config directory \"%s\""
|
||||||
msgstr "Невірний набір символів по масці \"%s\"!"
|
msgstr ""
|
||||||
|
|
||||||
|
@ -28,9 +28,10 @@ unit LazUtilsStrConsts;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
resourceString
|
resourceString
|
||||||
rsModified = ' modified ';
|
lrsModified = ' modified ';
|
||||||
sInvalidCharSet = 'The char set in mask "%s" is not valid!';
|
lrsInvalidCharSet = 'The char set in mask "%s" is not valid!';
|
||||||
rsSize = ' size ';
|
lrsSize = ' size ';
|
||||||
|
lrsUnableToCreateConfigDirectoryS = 'Unable to create config directory "%s"';
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ var
|
|||||||
|
|
||||||
procedure CharSetError;
|
procedure CharSetError;
|
||||||
begin
|
begin
|
||||||
raise EConvertError.CreateFmt(sInvalidCharSet, [AValue]);
|
raise EConvertError.CreateFmt(lrsInvalidCharSet, [AValue]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure AddAnyText;
|
procedure AddAnyText;
|
||||||
|
@ -194,10 +194,10 @@ begin
|
|||||||
//Result:=Result+' Owner: '+IntToStr(info.uid)+'.'+IntToStr(info.gid);
|
//Result:=Result+' Owner: '+IntToStr(info.uid)+'.'+IntToStr(info.gid);
|
||||||
|
|
||||||
// size
|
// size
|
||||||
Result:=Result+rsSize+IntToStr(info.st_size);
|
Result:=Result+lrsSize+IntToStr(info.st_size);
|
||||||
|
|
||||||
// date + time
|
// date + time
|
||||||
Result:=Result+rsModified;
|
Result:=Result+lrsModified;
|
||||||
try
|
try
|
||||||
Result:=Result+FormatDateTime('DD/MM/YYYY hh:mm',
|
Result:=Result+FormatDateTime('DD/MM/YYYY hh:mm',
|
||||||
FileDateToDateTime(FileAgeUTF8(AFilename)));
|
FileDateToDateTime(FileAgeUTF8(AFilename)));
|
||||||
|
Loading…
Reference in New Issue
Block a user