You've already forked lazarus-ccr
RxFPC:New function in RxFileUtils - NormalizeFileName. Fix languages
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4815 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
14
components/rx/trunk/docs/rxfileutils.xml
Normal file
14
components/rx/trunk/docs/rxfileutils.xml
Normal file
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<fpdoc-descriptions><package name="rxtools"><module name="rxFileUtils"><short>Модуль содержит вспомогательные утилиты для работы с файлами и каталогами</short><element name="FileNameDisabledChars"><short>Список символов, которые нельзя использовать в имени фала</short><descr><p>Константа FileNameDisabledChars содержит список символов, которые нельзя использовать в имени файла.</p><p>Значения константы зависит от платформы</p>
|
||||
</descr>
|
||||
</element><element name="IsValidFileNameChar"><short>Функция проверяет допустимост использования символа в имени файла</short>
|
||||
</element><element name="NormalizeFileName"><short>Функция приводит имя файла к правильному виду в зависимости от платформы</short><descr><p>Данная функция проверяет все символы в имени файла и заменяет запрещённые символы на указанный <b>AReplaceChar</b>.</p><p>По умолчанию вместо AReplaceChar подставляется символ "_" (подчёркивание)</p>
|
||||
</descr>
|
||||
</element><element name="GetFileOwnerUser"><short>Функция возвращает имя пользователя - владельца файла</short>
|
||||
</element><element name="GetFileOwnerData"><short>Функция возвращает данные о владельце файла</short>
|
||||
</element><element name="NormalizeDirectoryName"><short>Функция приводит все разделители в полном пути к файлу к виду принятом на текущей платформе</short>
|
||||
</element><element name="GetUserName"><short>Функция возвращяет имя текущего пользователя, зарегистрированного в операционной сиситеме на рабочем месте</short>
|
||||
</element>
|
||||
</module>
|
||||
</package>
|
||||
</fpdoc-descriptions>
|
@ -30,7 +30,9 @@ msgid "Change password"
|
||||
msgstr "Cambiar clave"
|
||||
|
||||
#: rxdconst.scirculardatalink
|
||||
msgid "SCircularDataLink"
|
||||
#, fuzzy
|
||||
#| msgid "SCircularDataLink"
|
||||
msgid "Circular data link"
|
||||
msgstr "SCircularEnlaceDato"
|
||||
|
||||
#: rxdconst.scollumnname
|
||||
@ -51,10 +53,6 @@ msgstr "Dato cambiado. Salvar?"
|
||||
msgid "Database locked: %s"
|
||||
msgstr "Base de Dato bloqueada: %s"
|
||||
|
||||
#: rxdconst.sdatasourcefixed
|
||||
msgid "SDataSourceFixed"
|
||||
msgstr "SFuenteDatosFija"
|
||||
|
||||
#: rxdconst.sdbcomboboxfieldnotassigned
|
||||
msgid "%s:TDBComboBox - DataField not assigned"
|
||||
msgstr ""
|
||||
@ -341,10 +339,6 @@ msgstr ""
|
||||
msgid "Print options"
|
||||
msgstr ""
|
||||
|
||||
#: rxdconst.spropdefbylookup
|
||||
msgid "PropDefByLookup"
|
||||
msgstr "PropDefByLookup"
|
||||
|
||||
#: rxdconst.sregistration
|
||||
msgid "Register"
|
||||
msgstr "Registro"
|
||||
|
@ -30,7 +30,7 @@ msgid "Change password"
|
||||
msgstr ""
|
||||
|
||||
#: rxdconst.scirculardatalink
|
||||
msgid "SCircularDataLink"
|
||||
msgid "Circular data link"
|
||||
msgstr ""
|
||||
|
||||
#: rxdconst.scollumnname
|
||||
@ -49,10 +49,6 @@ msgstr ""
|
||||
msgid "Database locked: %s"
|
||||
msgstr ""
|
||||
|
||||
#: rxdconst.sdatasourcefixed
|
||||
msgid "SDataSourceFixed"
|
||||
msgstr ""
|
||||
|
||||
#: rxdconst.sdbcomboboxfieldnotassigned
|
||||
msgid "%s:TDBComboBox - DataField not assigned"
|
||||
msgstr ""
|
||||
@ -329,10 +325,6 @@ msgstr ""
|
||||
msgid "Print options"
|
||||
msgstr ""
|
||||
|
||||
#: rxdconst.spropdefbylookup
|
||||
msgid "PropDefByLookup"
|
||||
msgstr ""
|
||||
|
||||
#: rxdconst.sregistration
|
||||
msgid "Register"
|
||||
msgstr ""
|
||||
|
@ -7,7 +7,7 @@ msgstr "Программа \"%s\""
|
||||
|
||||
#: rxdconst.sblobtext
|
||||
msgid "(blob)"
|
||||
msgstr ""
|
||||
msgstr "(данные)"
|
||||
|
||||
#: rxdconst.sbottomcaption
|
||||
msgid "Bottom"
|
||||
@ -30,7 +30,7 @@ msgid "Change password"
|
||||
msgstr "Изменить пароль"
|
||||
|
||||
#: rxdconst.scirculardatalink
|
||||
msgid "SCircularDataLink"
|
||||
msgid "Circular data link"
|
||||
msgstr "Перекрёстная ссылка данных"
|
||||
|
||||
#: rxdconst.scollumnname
|
||||
@ -49,10 +49,6 @@ msgstr "Данные были изменены. Сохранить?"
|
||||
msgid "Database locked: %s"
|
||||
msgstr "База данных блокирована: %s"
|
||||
|
||||
#: rxdconst.sdatasourcefixed
|
||||
msgid "SDataSourceFixed"
|
||||
msgstr ""
|
||||
|
||||
#: rxdconst.sdbcomboboxfieldnotassigned
|
||||
msgid "%s:TDBComboBox - DataField not assigned"
|
||||
msgstr "%s:TDBComboBox - Не присвоено свойство DataField"
|
||||
@ -329,10 +325,6 @@ msgstr "Печать списка"
|
||||
msgid "Print options"
|
||||
msgstr "Параметры печати"
|
||||
|
||||
#: rxdconst.spropdefbylookup
|
||||
msgid "PropDefByLookup"
|
||||
msgstr ""
|
||||
|
||||
#: rxdconst.sregistration
|
||||
msgid "Register"
|
||||
msgstr "Регистрация"
|
||||
|
@ -39,7 +39,9 @@ msgid "Change password"
|
||||
msgstr "Змінити пароль"
|
||||
|
||||
#: rxdconst.scirculardatalink
|
||||
msgid "SCircularDataLink"
|
||||
#, fuzzy
|
||||
#| msgid "SCircularDataLink"
|
||||
msgid "Circular data link"
|
||||
msgstr "Перехресне посилання даних"
|
||||
|
||||
#: rxdconst.scollumnname
|
||||
@ -58,10 +60,6 @@ msgstr "Дані були змінені. Зберегти?"
|
||||
msgid "Database locked: %s"
|
||||
msgstr "База даних блокована: %s"
|
||||
|
||||
#: rxdconst.sdatasourcefixed
|
||||
msgid "SDataSourceFixed"
|
||||
msgstr ""
|
||||
|
||||
#: rxdconst.sdbcomboboxfieldnotassigned
|
||||
msgid "%s:TDBComboBox - DataField not assigned"
|
||||
msgstr "%s:TDBComboBox - Не присвоєно властивість DataField"
|
||||
@ -339,10 +337,6 @@ msgstr "Друк таблиці"
|
||||
msgid "Print options"
|
||||
msgstr "Налаштування друку"
|
||||
|
||||
#: rxdconst.spropdefbylookup
|
||||
msgid "PropDefByLookup"
|
||||
msgstr ""
|
||||
|
||||
#: rxdconst.sregistration
|
||||
msgid "Register"
|
||||
msgstr "Реєстрація"
|
||||
|
@ -3191,7 +3191,6 @@ procedure TRxDBGrid.CollumnSortListUpdate;
|
||||
var
|
||||
i, J:integer;
|
||||
C:TRxColumn;
|
||||
|
||||
begin
|
||||
FSortColumns.Clear;
|
||||
for i:=0 to Columns.Count - 1 do
|
||||
|
@ -87,9 +87,9 @@ resourcestring
|
||||
|
||||
SDBComboBoxFieldNotAssigned = '%s:TDBComboBox - DataField not assigned';
|
||||
|
||||
SPropDefByLookup = 'PropDefByLookup';
|
||||
SDataSourceFixed = 'SDataSourceFixed';
|
||||
SCircularDataLink = 'SCircularDataLink';
|
||||
//SPropDefByLookup = 'PropDefByLookup';
|
||||
//SDataSourceFixed = 'SDataSourceFixed';
|
||||
SCircularDataLink = 'Circular data link';
|
||||
sRxAscendign = 'Ascendign';
|
||||
sRxDescending = 'Descending';
|
||||
sRxAllFields = 'All fields';
|
||||
|
@ -43,6 +43,16 @@ procedure GetFileOwnerData(const SearchDomain, FileName:String;out UserName, Dom
|
||||
function NormalizeDirectoryName(const DirName:string):string;
|
||||
function GetUserName:string;
|
||||
|
||||
function IsValidFileNameChar(const AChar: Char): Boolean;inline;
|
||||
function NormalizeFileName(const FileName:string; AReplaceChar:char = '_'):string; //funtion only for filename - without folder name
|
||||
|
||||
const
|
||||
{$IFDEF WINDOWS}
|
||||
FileNameDisabledChars = [#0 .. #31, '"', '*', '/', ':', '<', '>', '?', '\' , '|'];
|
||||
{$ELSE}
|
||||
FileNameDisabledChars = [#0 .. #31, '/', '~'];
|
||||
{$ENDIF}
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
@ -207,5 +217,20 @@ begin
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
function IsValidFileNameChar(const AChar: Char): Boolean;
|
||||
begin
|
||||
Result:=not (AChar in FileNameDisabledChars);
|
||||
end;
|
||||
|
||||
function NormalizeFileName(const FileName: string; AReplaceChar:char = '_'): string;
|
||||
var
|
||||
i:integer;
|
||||
begin
|
||||
Result:=FileName;
|
||||
for i:=1 to Length(Result) do
|
||||
if not IsValidFileNameChar(Result[i]) then
|
||||
Result[i]:=AReplaceChar;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
|
@ -33,6 +33,7 @@
|
||||
<UnitName Value="rxFileUtils"/>
|
||||
</Item4>
|
||||
</Files>
|
||||
<LazDoc Paths="docs;/usr/local/share/lazarus/components/rxnew/docs"/>
|
||||
<RequiredPkgs Count="1">
|
||||
<Item1>
|
||||
<PackageName Value="FCL"/>
|
||||
|
Reference in New Issue
Block a user