[Haskell-cafe] Re: Unicode workaround for getDirectoryContents
marlowsd at gmail.com
Tue Jun 16 11:30:55 EDT 2009
On 16/06/2009 14:56, Bulat Ziganshin wrote:
> Hello Simon,
> Tuesday, June 16, 2009, 5:02:43 PM, you wrote:
>> Also currently broken:
>> * calling removeFile on a FilePath you get from getDirectoryContents,
>> amongst other System.Directory operations
>> Fixing getDirectoryContents will fix these.
> no. removeFile like anything else also uses ACP-based api
What code are you looking at?
Here is System.Directory.removeFile:
removeFile :: FilePath -> IO ()
removeFile path =
deleteFile :: String -> IO ()
deleteFile name =
withTString name $ \ c_name ->
failIfFalse_ "DeleteFile" $ c_DeleteFile c_name
foreign import stdcall unsafe "windows.h DeleteFileW"
c_DeleteFile :: LPCTSTR -> IO Bool
note it's calling DeleteFileW, and using wide-char strings.
> Windows libraries emulates POSIX API (open, opendir, stat and so on)
> by translating these (char-based) calls into A-family. GHC libs are
> written Unix way, so these are effectively bundled to A-family of Win
Actually we use a mixture of CRT functions and native Windows API,
gradually moving in the direction of the latter.
More information about the Haskell-Cafe