]> gitweb.factorcode.org Git - factor.git/commitdiff
io.files.temp.windows: fix up
authorJoe Groff <arcata@gmail.com>
Sun, 1 Apr 2012 00:11:38 +0000 (17:11 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Mon, 16 Apr 2012 18:55:33 +0000 (11:55 -0700)
basis/io/files/temp/windows/windows.factor
basis/windows/kernel32/kernel32.factor

index 95ab4a35c3555ce4a691fe880c0b1397253a8d39..66e9e94bf7d44bdd07782a735345b1b63135ec5a 100644 (file)
@@ -1,13 +1,17 @@
 ! (c)2012 Joe Groff bsd license
 ! (c)2012 Joe Groff bsd license
-USING: ;
+USING: alien.data alien.strings io.directories
+io.encodings.utf16n io.files.temp io.pathnames kernel math
+memoize specialized-arrays system windows.errors
+windows.kernel32 windows.ole32 windows.shell32
+windows.types ;
 SPECIALIZED-ARRAY: WCHAR
 IN: io.files.temp.windows
 
 <PRIVATE
 
 : (get-temp-directory) ( -- path )
 SPECIALIZED-ARRAY: WCHAR
 IN: io.files.temp.windows
 
 <PRIVATE
 
 : (get-temp-directory) ( -- path )
-    MAX_PATH dup <WCHAR-array> [ GetTempPath ] keep
-    swap win32-error
+    MAX_PATH 1 + dup WCHAR <c-array> [ GetTempPath ] keep
+    swap win32-error=0/f
     utf16n alien>string ;
 
 : (get-appdata-directory) ( -- path )
     utf16n alien>string ;
 
 : (get-appdata-directory) ( -- path )
@@ -15,9 +19,9 @@ IN: io.files.temp.windows
     CSIDL_LOCAL_APPDATA CSIDL_FLAG_CREATE bitor
     f
     0
     CSIDL_LOCAL_APPDATA CSIDL_FLAG_CREATE bitor
     f
     0
-    MAX_PATH <WCHAR-array>
+    MAX_PATH 1 + WCHAR <c-array>
     [ SHGetFolderPath ] keep
     [ SHGetFolderPath ] keep
-    swap win32-error
+    swap ole32-error
     utf16n alien>string ;
 
 PRIVATE>
     utf16n alien>string ;
 
 PRIVATE>
index 8cb41106fcda8f4e94049cd912cfdcb8a91b1646..7cdacabb8befe4e148fa381163ffb271807f20dd 100644 (file)
@@ -1402,7 +1402,8 @@ ALIAS: GetSystemWindowsDirectory GetSystemWindowsDirectoryW
 ! FUNCTION: GetTempFileNameA
 ! FUNCTION: GetTempFileNameW
 ! FUNCTION: GetTempPathA
 ! FUNCTION: GetTempFileNameA
 ! FUNCTION: GetTempFileNameW
 ! FUNCTION: GetTempPathA
-! FUNCTION: GetTempPathW
+FUNCTION: DWORD GetTempPathW ( DWORD nBufferLength, LPWSTR lpBuffer ) ;
+ALIAS: GetTempPath GetTempPathW
 ! FUNCTION: GetThreadContext
 ! FUNCTION: GetThreadIOPendingFlag
 ! FUNCTION: GetThreadLocale
 ! FUNCTION: GetThreadContext
 ! FUNCTION: GetThreadIOPendingFlag
 ! FUNCTION: GetThreadLocale