Re[2]: [Haskell-cafe] Re: Unicode workaround for getDirectoryContents under Windows?

2009-06-17 Thread Bulat Ziganshin
Hello Simon, Wednesday, June 17, 2009, 12:46:49 PM, you wrote: > I see, so you were previously quoting code from some other source. from my program > Where did the GetCommandLineW version come from? Do you know of any > issues that would prevent us using it in GHC? it should be as fine as an

Re[2]: [Haskell-cafe] Re: Unicode workaround for getDirectoryContents under Windows?

2009-06-17 Thread Bulat Ziganshin
Hello Simon, Wednesday, June 17, 2009, 12:01:11 PM, you wrote: > foreign import stdcall unsafe "GetFullPathNameW" >c_GetFullPathName :: LPCTSTR -> DWORD -> LPTSTR -> Ptr LPTSTR -> IO DWORD you are right, i was troubled by unused GetFullPathNameA import in System.Directory: #if defined(ming

Re[2]: [Haskell-cafe] Re: Unicode workaround for getDirectoryContents under Windows?

2009-06-17 Thread Bulat Ziganshin
Hello Simon, Wednesday, June 17, 2009, 11:55:15 AM, you wrote: > Right, so getArgs is already fine. it's what i've found in Jun15 sources: #ifdef __GLASGOW_HASKELL__ getArgs :: IO [String] getArgs = alloca $ \ p_argc -> alloca $ \ p_argv -> do getProgArgv p_argc p_argv p<- fromInt

Re[2]: [Haskell-cafe] Re: Unicode workaround for getDirectoryContents under Windows?

2009-06-16 Thread Bulat Ziganshin
Hello Simon, Tuesday, June 16, 2009, 5:02:43 PM, you wrote: > I don't know how getArgs fits in here - should we be decoding argv using > the ACP? myGetArgs = do alloca $ \p_argc -> do p_argv_w <- commandLineToArgvW getCommandLineW p_argc argc <- peek p_argc argv_w <- peekArray

Re[2]: [Haskell-cafe] Re: Unicode workaround for getDirectoryContents under Windows?

2009-06-16 Thread Bulat Ziganshin
Hello Simon, Tuesday, June 16, 2009, 7:54:02 PM, you wrote: > In fact there's not a lot left to convert in System.Directory, as you'll > see if you look at the code. Feel like helping? these functions used there are ACP-only: c_stat c_chmod System.Win32.getFullPathName c_SearchPath c_SHGetFold

Re[2]: [Haskell-cafe] Re: Unicode workaround for getDirectoryContents under Windows?

2009-06-16 Thread Bulat Ziganshin
Hello Simon, Tuesday, June 16, 2009, 7:30:55 PM, you wrote: > Actually we use a mixture of CRT functions and native Windows API, > gradually moving in the direction of the latter. so file-related APIs are already unpredictable, and will remain in this state for unknown amount of ghc versions -

Re[2]: [Haskell-cafe] Re: Unicode workaround for getDirectoryContents under Windows?

2009-06-16 Thread Bulat Ziganshin
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 us

Re[2]: [Haskell-cafe] Re: Unicode workaround for getDirectoryContents under Windows?

2009-06-16 Thread Bulat Ziganshin
Hello Simon, Tuesday, June 16, 2009, 4:34:29 PM, you wrote: > Thanks for reminding me that openFile is also broken. It's easily > fixed, so I'll look into that. i fear that it will leave GHC libs in inconsistent state that can drive users mad. now at least there are some rules of brokeness. whe