]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/io/files/temp/windows/windows.factor
io.files.temp.windows: fix up
[factor.git] / basis / io / files / temp / windows / windows.factor
index 95ab4a35c3555ce4a691fe880c0b1397253a8d39..66e9e94bf7d44bdd07782a735345b1b63135ec5a 100644 (file)
@@ -1,13 +1,17 @@
 ! (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 )
-    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 )
@@ -15,9 +19,9 @@ IN: io.files.temp.windows
     CSIDL_LOCAL_APPDATA CSIDL_FLAG_CREATE bitor
     f
     0
-    MAX_PATH <WCHAR-array>
+    MAX_PATH 1 + WCHAR <c-array>
     [ SHGetFolderPath ] keep
-    swap win32-error
+    swap ole32-error
     utf16n alien>string ;
 
 PRIVATE>