mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-10 03:16: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)));
|
||||
end;
|
||||
|
||||
function GetAppConfigDirUTF8(Global: Boolean): string;
|
||||
function GetAppConfigDirUTF8(Global: Boolean; Create: boolean = false): string;
|
||||
begin
|
||||
Result:=SysToUTF8(SysUtils.GetAppConfigDir(Global));
|
||||
if Result='' then exit;
|
||||
if Create and not ForceDirectoriesUTF8(Result) then
|
||||
raise EInOutError.Create(Format(lrsUnableToCreateConfigDirectoryS,[Result]));
|
||||
end;
|
||||
|
||||
function GetAppConfigFileUTF8(Global: Boolean; SubDir: boolean): string;
|
||||
function GetAppConfigFileUTF8(Global: Boolean; SubDir: boolean;
|
||||
CreateDir: boolean): string;
|
||||
var
|
||||
Dir: string;
|
||||
begin
|
||||
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;
|
||||
|
||||
function SysErrorMessageUTF8(ErrorCode: Integer): String;
|
||||
|
@ -233,8 +233,9 @@ function FileCreateUTF8(Const FileName : string; Rights: Cardinal) : THandle; ov
|
||||
function ParamStrUTF8(Param: Integer): string;
|
||||
function GetEnvironmentStringUTF8(Index: Integer): string;
|
||||
function GetEnvironmentVariableUTF8(const EnvVar: string): String;
|
||||
function GetAppConfigDirUTF8(Global: Boolean): string;
|
||||
function GetAppConfigFileUTF8(Global: Boolean; SubDir: boolean = false): string;
|
||||
function GetAppConfigDirUTF8(Global: Boolean; Create: boolean = false): string;
|
||||
function GetAppConfigFileUTF8(Global: Boolean; SubDir: boolean = false;
|
||||
CreateDir: boolean = false): string;
|
||||
|
||||
// other
|
||||
function SysErrorMessageUTF8(ErrorCode: Integer): String;
|
||||
|
@ -9,15 +9,22 @@ msgstr ""
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: lazutilsstrconsts.rsmodified
|
||||
msgid " modified "
|
||||
msgstr "geändert"
|
||||
|
||||
#: lazutilsstrconsts.rssize
|
||||
msgid " size "
|
||||
msgstr "Größe"
|
||||
|
||||
#: lazutilsstrconsts.sinvalidcharset
|
||||
#: lazutilsstrconsts.lrsinvalidcharset
|
||||
msgctxt "lazutilsstrconsts.lrsinvalidcharset"
|
||||
msgid "The char set in mask \"%s\" is not valid!"
|
||||
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 ""
|
||||
msgstr "Content-Type: text/plain; charset=UTF-8"
|
||||
|
||||
#: lazutilsstrconsts.rsmodified
|
||||
msgid " modified "
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rssize
|
||||
msgid " size "
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.sinvalidcharset
|
||||
#: lazutilsstrconsts.lrsinvalidcharset
|
||||
msgctxt "lazutilsstrconsts.lrsinvalidcharset"
|
||||
msgid "The char set in mask \"%s\" is not valid!"
|
||||
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"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: lazutilsstrconsts.rsmodified
|
||||
msgid " modified "
|
||||
msgstr " modificado"
|
||||
|
||||
#: lazutilsstrconsts.rssize
|
||||
msgid " size "
|
||||
msgstr " tamanho"
|
||||
|
||||
#: lazutilsstrconsts.sinvalidcharset
|
||||
#: lazutilsstrconsts.lrsinvalidcharset
|
||||
msgctxt "lazutilsstrconsts.lrsinvalidcharset"
|
||||
msgid "The char set in mask \"%s\" is not valid!"
|
||||
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"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: lazutilsstrconsts.rsmodified
|
||||
msgid " modified "
|
||||
msgstr " изменён "
|
||||
|
||||
#: lazutilsstrconsts.rssize
|
||||
msgid " size "
|
||||
msgstr " размер "
|
||||
|
||||
#: lazutilsstrconsts.sinvalidcharset
|
||||
#: lazutilsstrconsts.lrsinvalidcharset
|
||||
msgctxt "lazutilsstrconsts.lrsinvalidcharset"
|
||||
msgid "The char set in mask \"%s\" is not valid!"
|
||||
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 ""
|
||||
msgstr ""
|
||||
"PO-Revision-Date: 2012-04-23 10:30+0300\n"
|
||||
@ -6,18 +5,25 @@ msgstr ""
|
||||
"Language: uk\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\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"
|
||||
"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"
|
||||
"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 "
|
||||
msgstr " змінено "
|
||||
|
||||
#: lazutilsstrconsts.rssize
|
||||
#: lazutilsstrconsts.lrssize
|
||||
msgctxt "lazutilsstrconsts.lrssize"
|
||||
msgid " size "
|
||||
msgstr " розмір "
|
||||
|
||||
#: lazutilsstrconsts.sinvalidcharset
|
||||
msgid "The char set in mask \"%s\" is not valid!"
|
||||
msgstr "Невірний набір символів по масці \"%s\"!"
|
||||
#: lazutilsstrconsts.lrsunabletocreateconfigdirectorys
|
||||
msgid "Unable to create config directory \"%s\""
|
||||
msgstr ""
|
||||
|
||||
|
@ -28,9 +28,10 @@ unit LazUtilsStrConsts;
|
||||
interface
|
||||
|
||||
resourceString
|
||||
rsModified = ' modified ';
|
||||
sInvalidCharSet = 'The char set in mask "%s" is not valid!';
|
||||
rsSize = ' size ';
|
||||
lrsModified = ' modified ';
|
||||
lrsInvalidCharSet = 'The char set in mask "%s" is not valid!';
|
||||
lrsSize = ' size ';
|
||||
lrsUnableToCreateConfigDirectoryS = 'Unable to create config directory "%s"';
|
||||
|
||||
implementation
|
||||
|
||||
|
@ -121,7 +121,7 @@ var
|
||||
|
||||
procedure CharSetError;
|
||||
begin
|
||||
raise EConvertError.CreateFmt(sInvalidCharSet, [AValue]);
|
||||
raise EConvertError.CreateFmt(lrsInvalidCharSet, [AValue]);
|
||||
end;
|
||||
|
||||
procedure AddAnyText;
|
||||
|
@ -194,10 +194,10 @@ begin
|
||||
//Result:=Result+' Owner: '+IntToStr(info.uid)+'.'+IntToStr(info.gid);
|
||||
|
||||
// size
|
||||
Result:=Result+rsSize+IntToStr(info.st_size);
|
||||
Result:=Result+lrsSize+IntToStr(info.st_size);
|
||||
|
||||
// date + time
|
||||
Result:=Result+rsModified;
|
||||
Result:=Result+lrsModified;
|
||||
try
|
||||
Result:=Result+FormatDateTime('DD/MM/YYYY hh:mm',
|
||||
FileDateToDateTime(FileAgeUTF8(AFilename)));
|
||||
|
Loading…
Reference in New Issue
Block a user