]> git.lyx.org Git - lyx.git/blobdiff - development/cygwin/lyxwin.c
Script for finding unneeded headers
[lyx.git] / development / cygwin / lyxwin.c
index d57bfa4e02fb750f8dadb780a37fd63011f85e8d..d1ac5bf0fe627473ee37e6b21b70e53c8600659f 100644 (file)
 #include <process.h>
 #include <string.h>
 #include <limits.h>
+#include <cygwin/version.h>
 #include <sys/cygwin.h>
 #include <windows.h>
 
+void convert_to_posix_path(char const * from, char *to)
+{
+#if CYGWIN_VERSION_DLL_MAJOR >= 1007
+    cygwin_conv_path(CCP_WIN_A_TO_POSIX | CCP_RELATIVE, from, to, PATH_MAX);
+#else
+    cygwin_conv_to_posix_path(from, to);
+#endif
+}
+
 int main (int argc, char **argv, char **environ)
 {
        FILE *fp;
@@ -44,7 +54,7 @@ int main (int argc, char **argv, char **environ)
                                && strcasecmp(s, ".lyx") == 0;
                /* Add initial quote */
                strcat(cmd, "\"");
-               cygwin_conv_to_posix_path(argv[i], posixpath) ;
+               convert_to_posix_path(argv[i], posixpath) ;
                /* Hack to account for shares */
                if (lyxfile && argv[i][0] == '\\' && argv[i][1] != '\\')
                        strcat(cmd, "/");
@@ -64,7 +74,7 @@ int main (int argc, char **argv, char **environ)
 
        /* fprintf(stderr , "Command is: |%s|\n", cmd); */
        /* ensure bash reads our global env changes */
-       putenv("BASH_ENV=/etc/lyxprofile") ;
+       putenv("BASH_ENV=" LYX_ABS_INSTALLED_DATADIR "/lyxprofile") ;
        /* exec sub command */
        spawnv(_P_NOWAIT, "/bin/bash", nargs);
        /* exit with no error */