* made ToSingleByteFileSystemEncodedFileName(unicodestring) overridable by

target-specific code and implemented a JVM-compatible version

git-svn-id: branches/cpstrrtl@25001 -
This commit is contained in:
Jonas Maebe 2013-06-27 21:38:17 +00:00
parent 1da05d1553
commit 8a4b092ab9
2 changed files with 10 additions and 0 deletions

View File

@ -2286,11 +2286,14 @@ procedure initunicodestringmanager;
{$endif FPC_HAS_BUILTIN_WIDESTR_MANAGER}
{$ifndef FPC_HAS_TOSINGLEBYTEFILESYSTEMENCODEDFILENAME_UNICODESTRING}
{$define FPC_HAS_TOSINGLEBYTEFILESYSTEMENCODEDFILENAME_UNICODESTRING}
Function ToSingleByteFileSystemEncodedFileName(const Str: UnicodeString): RawByteString;
Begin
widestringmanager.Unicode2AnsiMoveProc(punicodechar(Str),Result,
DefaultFileSystemCodePage,Length(Str));
End;
{$endif FPC_HAS_TOSINGLEBYTEFILESYSTEMENCODEDFILENAME_UNICODESTRING}
Function ToSingleByteFileSystemEncodedFileName(const Str: RawByteString): RawByteString;

View File

@ -906,6 +906,13 @@ function StringCodePage(const S : UnicodeString): TSystemCodePage;
result:=DefaultUnicodeCodePage;
end;
{$define FPC_HAS_TOSINGLEBYTEFILESYSTEMENCODEDFILENAME_UNICODESTRING}
Function ToSingleByteFileSystemEncodedFileName(const Str: UnicodeString): RawByteString;
Begin
result:=AnsiString(AnsistringClass.Create(Str,DefaultFileSystemCodePage));
End;
{ helpers for converting between Windows and Java code page identifiers }