updates getting us closer to working on windows. added a highly speculative implemen...
authorChris Koeritz <fred@gruntose.com>
Wed, 1 May 2013 19:16:45 +0000 (15:16 -0400)
committerChris Koeritz <fred@gruntose.com>
Wed, 1 May 2013 19:16:45 +0000 (15:16 -0400)
of touch in huge_file, which may not be right because windows file handling seems to continue
to suck the chrome off of bumpers.

nucleus/library/filesystem/huge_file.cpp
scripts/clam/cpp/variables.def
scripts/generator/wrapdoze.sh

index f452fd30e32bb93b923ee0749bfae72a116469b0..21158ca45bb03cbee8aef01ccef60fd2df34cc86 100644 (file)
 #include <basis/guards.h>
 
 #include <stdio.h>
-#include <sys/time.h>
+#ifndef __WIN32__
+  #include <sys/time.h>
+#else
+  #include <time.h>
+#endif
 
 #undef LOG
 #define LOG(to_print) printf("%s::%s: %s\n", static_class_name(), func, astring(to_print).s())
@@ -281,11 +285,31 @@ outcome huge_file::write(const byte_array &to_write, int &size_written)
 
 basis::outcome huge_file::touch()
 {
+  FUNCDEF("touch")
   if (filename(_real_file->name()).exists()) {
     // file exists, so just update time.
+#ifndef __WIN32__
     int ret = utimes(_real_file->name().observe(), NIL);
     if (ret != 0)
       return FAILURE;
+#else
+    // open the file, although the function says create in its name...
+    HANDLE f = CreateFile(_real_file->name().observe(),
+        GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE,
+        NIL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NIL);
+    if (!f) {
+      LOG(a_sprintf("failed to open file %s", _real_file->name().observe()));
+      return FAILURE;
+    }
+    // get current system time in UTC.
+    SYSTEMTIME *st = new SYSTEMTIME;
+    GetSystemTime(st);
+    // convert system time into file time.
+    FILETIME *t = new FILETIME;
+    SystemTimeToFileTime(st, t);
+    // set the file's time.
+    SetFileTime(f, NIL, t, t);
+#endif
   } else {
     // file doesn't exist yet.
     byte_array junk(1);
index 74334a22fd54348e9909574a6662d4b158be20d7..dcf704612a6912a5f48f9ce2687635fef5018016 100644 (file)
@@ -238,7 +238,8 @@ ifeq "$(HOOPLE_HEADERS)" ""
       echo "$(FEISTY_MEOW_DIR)/nucleus" "$(FEISTY_MEOW_DIR)/octopi" "$(FEISTY_MEOW_DIR)/graphiq" ; \
     else \
       echo ""; \
-    fi | sed -e "s/\([a-zA-Z]\):\/\(.*\)/\/\1\/\2/" ')
+    fi | tr "\\\\" / | sed -e "s/\([a-zA-Z]\):\/\([^ ]*\)/\/cygdrive\/\1\/\2/g" ')
+    # above assumes cygwin support for windows!  was assuming msys support.
   HOOPLE_HEADERS := $(shell $(FIND) $(LOCUS_LIBRARY_HEADERS) -mindepth 1 -maxdepth 1 -type d )
 endif
 
index 2ab57af5e121ce7ddb8b76f1389a902ae2c3aaf8..d7432835e403dedaf5ea505f3aa490ca6f1c67c2 100755 (executable)
@@ -15,13 +15,12 @@ function dossify_and_run_commands()
 
   for i in "$@"; do
     if [[ "$i" =~ ^-[a-zA-z][/\"].* ]]; then
-echo found parameter to fix...
       flag="${i:0:2}"
       filename="$(unix_to_dos_path ${i:2})"
-echo "first two chars are $flag"
-echo "last after that are $filename"
+#echo "first two chars are $flag"
+#echo "last after that are $filename"
       recombined="$flag$filename"
-echo combined flag and file is $recombined
+#echo combined flag and file is $recombined
       darc_commands+=("$recombined")
     else 
       darc_commands+=($(unix_to_dos_path $i))
@@ -34,10 +33,11 @@ echo combined flag and file is $recombined
   done
 
 #temp!
-  echo commands are now: >>/tmp/wrapdoze.log
+  echo commands are now:
   for i in "${real_commands[@]}"; do
-    echo $i >>/tmp/wrapdoze.log
+    echo -n "$i "
   done
+  echo
 #end temp
 
   # now actually run the chewed command.