diff options
author | jonas <jonas@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2013-07-09 19:01:45 +0000 |
---|---|---|
committer | jonas <jonas@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2013-07-09 19:01:45 +0000 |
commit | 2aca1b6c531686b8e07cc6473d1d23a077fdf834 (patch) | |
tree | baa4c5cbc58c7fb1c3a9a3fbdaf516f7760e2053 /rtl/emx | |
parent | 45cc10e06b8f6c91a2682117ef34806fa01fcc5b (diff) | |
download | fpc-2aca1b6c531686b8e07cc6473d1d23a077fdf834.tar.gz |
* converted the following sysutils routines to unicodestring and
rawbytestring: FileExists, DirectoryExists, FileSetDate, FileGetAttr,
FileSetAttr, DeleteFile, RenameFile, FileSearch, ExeSearch,
FileIsReadOnly
git-svn-id: http://svn.freepascal.org/svn/fpc/branches/cpstrrtl@25078 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'rtl/emx')
-rw-r--r-- | rtl/emx/sysutils.pp | 105 |
1 files changed, 52 insertions, 53 deletions
diff --git a/rtl/emx/sysutils.pp b/rtl/emx/sysutils.pp index db525b5766..d35c37d3af 100644 --- a/rtl/emx/sysutils.pp +++ b/rtl/emx/sysutils.pp @@ -654,10 +654,11 @@ begin end; -function FileExists (const FileName: string): boolean; +function FileExists (const FileName: RawByteString): boolean; var L: longint; begin + { no need to convert to DefaultFileSystemEncoding, FileGetAttr will do that } if FileName = '' then Result := false else @@ -895,59 +896,56 @@ asm end {['eax', 'edx']}; -function FileSetAttr (const Filename: string; Attr: longint): longint; assembler; -asm -{$IFDEF REGCALL} - mov ecx, edx - mov edx, eax -{$ELSE REGCALL} - mov ecx, Attr - mov edx, FileName -{$ENDIF REGCALL} - mov ax, 4301h - call syscall - mov eax, 0 - jnc @FSetAttrEnd - mov eax, -1 -@FSetAttrEnd: -end {['eax', 'ecx', 'edx']}; - - -function DeleteFile (const FileName: string): boolean; assembler; -asm -{$IFDEF REGCALL} - mov edx, eax -{$ELSE REGCALL} - mov edx, FileName -{$ENDIF REGCALL} - mov ax, 4100h - call syscall - mov eax, 0 - jc @FDeleteEnd - inc eax -@FDeleteEnd: -end {['eax', 'edx']}; - +function FileSetAttr (const Filename: RawByteString; Attr: longint): longint; +var + SystemFileName: RawByteString; +begin + SystemFileName:=ToSingleByteFileSystemEncodedFileName(Filename); + asm + mov ecx, Attr + mov edx, SystemFileName + mov ax, 4301h + call syscall + mov @result, 0 + jnc @FSetAttrEnd + mov @result, -1 + @FSetAttrEnd: + end ['eax', 'ecx', 'edx']; +end; -function RenameFile (const OldName, NewName: string): boolean; assembler; -asm - push edi -{$IFDEF REGCALL} - mov edx, eax - mov edi, edx -{$ELSE REGCALL} - mov edx, OldName - mov edi, NewName -{$ENDIF REGCALL} - mov ax, 5600h - call syscall - mov eax, 0 - jc @FRenameEnd - inc eax -@FRenameEnd: - pop edi -end {['eax', 'edx', 'edi']}; +function DeleteFile (const FileName: string): boolean; +var + SystemFileName: RawByteString; +begin + SystemFileName:=ToSingleByteFileSystemEncodedFileName(Filename); + asm + mov edx, SystemFileName + mov ax, 4100h + call syscall + mov @result, 0 + jc @FDeleteEnd + moc @result, 1 + @FDeleteEnd: + end ['eax', 'edx']; +end; +function RenameFile (const OldName, NewName: string): boolean; +var + OldSystemFileName, NewSystemFileName: RawByteString; +Begin + OldSystemFileName:=ToSingleByteFileSystemEncodedFileName(OldName); + NewSystemFileName:=ToSingleByteFileSystemEncodedFileName(NewName); + asm + mov edx, OldSystemFileName + mov edi, NewSystemFileName + mov ax, 5600h + call syscall + mov @result, 0 + jc @FRenameEnd + mov @result, 1 + @FRenameEnd: + end ['eax', 'edx', 'edi']; +end; {**************************************************************************** Disk Functions @@ -1072,10 +1070,11 @@ begin end; -function DirectoryExists (const Directory: string): boolean; +function DirectoryExists (const Directory: RawByteString): boolean; var L: longint; begin + { no need to convert to DefaultFileSystemEncoding, FileGetAttr will do that } if Directory = '' then Result := false else |