lucy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nwelln...@apache.org
Subject [lucy-commits] [03/13] git commit: refs/heads/makefile-rework - Move detection of directory separator to chaz_OS
Date Wed, 15 May 2013 17:24:27 GMT
Move detection of directory separator to chaz_OS


Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/175f1153
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/175f1153
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/175f1153

Branch: refs/heads/makefile-rework
Commit: 175f115353a6ef70449c95fd3fd76529e3f41598
Parents: 893184b
Author: Nick Wellnhofer <wellnhofer@aevum.de>
Authored: Tue May 14 21:30:52 2013 +0200
Committer: Nick Wellnhofer <wellnhofer@aevum.de>
Committed: Wed May 15 19:13:53 2013 +0200

----------------------------------------------------------------------
 charmonizer/src/Charmonizer/Core/OperatingSystem.c |   10 +++++-
 charmonizer/src/Charmonizer/Core/OperatingSystem.h |    5 +++
 charmonizer/src/Charmonizer/Probe/DirManip.c       |   26 +--------------
 3 files changed, 15 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/175f1153/charmonizer/src/Charmonizer/Core/OperatingSystem.c
----------------------------------------------------------------------
diff --git a/charmonizer/src/Charmonizer/Core/OperatingSystem.c b/charmonizer/src/Charmonizer/Core/OperatingSystem.c
index a8f933b..31db30c 100644
--- a/charmonizer/src/Charmonizer/Core/OperatingSystem.c
+++ b/charmonizer/src/Charmonizer/Core/OperatingSystem.c
@@ -30,11 +30,12 @@
 static struct {
     char name[CHAZ_OS_NAME_MAX+1];
     char dev_null[20];
+    char dir_sep[2];
     char exe_ext[5];
     char shared_lib_ext[7];
     char local_command_start[3];
     int  shell_type;
-} chaz_OS = { "", "", "", "", "", 0 };
+} chaz_OS = { "", "", "", "", "", "", 0 };
 
 void
 chaz_OS_init(void) {
@@ -66,6 +67,7 @@ chaz_OS_init(void) {
         free(uname);
 
         strcpy(chaz_OS.dev_null, "/dev/null");
+        strcpy(chaz_OS.dir_sep, "/");
         strcpy(chaz_OS.exe_ext, "");
         if (memcmp(chaz_OS.name, "darwin", 6) == 0) {
             strcpy(chaz_OS.shared_lib_ext, ".dylib");
@@ -81,6 +83,7 @@ chaz_OS_init(void) {
     else if (chaz_Util_can_open_file("nul")) {
         strcpy(chaz_OS.name, "windows");
         strcpy(chaz_OS.dev_null, "nul");
+        strcpy(chaz_OS.dir_sep, "\\");
         strcpy(chaz_OS.exe_ext, ".exe");
         strcpy(chaz_OS.shared_lib_ext, ".dll");
         strcpy(chaz_OS.local_command_start, ".\\");
@@ -122,6 +125,11 @@ chaz_OS_dev_null(void) {
     return chaz_OS.dev_null;
 }
 
+const char*
+chaz_OS_dir_sep(void) {
+    return chaz_OS.dir_sep;
+}
+
 int
 chaz_OS_shell_type(void) {
     return chaz_OS.shell_type;

http://git-wip-us.apache.org/repos/asf/lucy/blob/175f1153/charmonizer/src/Charmonizer/Core/OperatingSystem.h
----------------------------------------------------------------------
diff --git a/charmonizer/src/Charmonizer/Core/OperatingSystem.h b/charmonizer/src/Charmonizer/Core/OperatingSystem.h
index c335cf3..84a7ac0 100644
--- a/charmonizer/src/Charmonizer/Core/OperatingSystem.h
+++ b/charmonizer/src/Charmonizer/Core/OperatingSystem.h
@@ -94,6 +94,11 @@ chaz_OS_shared_lib_ext(void);
 const char*
 chaz_OS_dev_null(void);
 
+/* Return the directory separator on this system.
+ */
+const char*
+chaz_OS_dir_sep(void);
+
 /* Return the shell type of this system.
  */
 int

http://git-wip-us.apache.org/repos/asf/lucy/blob/175f1153/charmonizer/src/Charmonizer/Probe/DirManip.c
----------------------------------------------------------------------
diff --git a/charmonizer/src/Charmonizer/Probe/DirManip.c b/charmonizer/src/Charmonizer/Probe/DirManip.c
index 8664ed6..47f68df 100644
--- a/charmonizer/src/Charmonizer/Probe/DirManip.c
+++ b/charmonizer/src/Charmonizer/Probe/DirManip.c
@@ -117,23 +117,9 @@ chaz_DirManip_try_rmdir(void) {
     if (chaz_DirManip_compile_rmdir("direct.h"))   { return; }
 }
 
-static int
-chaz_DirManip_is_cygwin(void) {
-    static int is_cygwin = -1;
-    static const char cygwin_code[] =
-        CHAZ_QUOTE(#ifndef __CYGWIN__            )
-        CHAZ_QUOTE(  #error "Not Cygwin"         )
-        CHAZ_QUOTE(#endif                        )
-        CHAZ_QUOTE(int main() { return 0; }      );
-    if (is_cygwin == -1) {
-        is_cygwin = chaz_CC_test_compile(cygwin_code);
-    }
-    return is_cygwin;
-}
-
 void
 chaz_DirManip_run(void) {
-    char dir_sep[3];
+    const char *dir_sep = chaz_OS_dir_sep();
     int remove_zaps_dirs = false;
     int has_dirent_h = chaz_HeadCheck_check_header("dirent.h");
     int has_direct_h = chaz_HeadCheck_check_header("direct.h");
@@ -191,16 +177,6 @@ chaz_DirManip_run(void) {
         chaz_ConfWriter_add_def("MAKEDIR_MODE_IGNORED", "1");
     }
 
-    if (chaz_DirManip_is_cygwin()) {
-        strcpy(dir_sep, "/");
-    }
-    else if (chaz_HeadCheck_check_header("windows.h")) {
-        strcpy(dir_sep, "\\\\");
-    }
-    else {
-        strcpy(dir_sep, "/");
-    }
-
     {
         char scratch[5];
         sprintf(scratch, "\"%s\"", dir_sep);


Mime
View raw message