Given a file name "C:/foo/bar", I believe that the name of the temporary
file should be "C__foo_bar". Ie, the drive name should be included in the
mangling. Ruurd was addressing this idea in his patch, but he simply
removed the drive prefix from the mangled name.
Do you agree that my approach is better? If so, are you happy with the
attached patches for the 13x and 14x trees?
Jean-Marc, I'll hang back and await your feedback on this; I've been a bit
rushy with my application of some of the other patches. Sorry 'bout that.
--
Angus
Index: src/insets/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/ChangeLog,v
retrieving revision 1.552.2.18
diff -u -p -r1.552.2.18 ChangeLog
--- src/insets/ChangeLog 14 Dec 2004 10:40:08 -0000 1.552.2.18
+++ src/insets/ChangeLog 16 Dec 2004 16:48:54 -0000
@@ -1,3 +1,9 @@
+2004-12-16 Angus Leeming <[EMAIL PROTECTED]>
+
+ * insetgraphics.C (prepareFile): Given a Windows-style path, don't
+ forget to mangle the drive letter too when generating a unique
+ temporary file name.
+
2004-12-14 Angus Leeming <[EMAIL PROTECTED]>
* Makefile.am (INCLUDES): Remove trailing slash from -Ifoo/
Index: src/insets/insetgraphics.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetgraphics.C,v
retrieving revision 1.146.2.4
diff -u -p -r1.146.2.4 insetgraphics.C
--- src/insets/insetgraphics.C 7 Dec 2004 10:49:34 -0000 1.146.2.4
+++ src/insets/insetgraphics.C 16 Dec 2004 16:48:54 -0000
@@ -623,6 +623,13 @@ string const InsetGraphics::prepareFile(
// without dots and again with ext
temp_file = ChangeExtension(
subst(temp_file, ".", "_"), ext_tmp);
+
+#if defined(__CYGWIN__) || defined(__CYGWIN32__) || defined(_WIN32)
+ // Mangle the drive letter in a Windows-style path.
+ if (temp_file.size() >= 2 && temp_file[1] == ':')
+ temp_file[1] = '_';
+#endif
+
// now we have any_dir_file.ext
temp_file = MakeAbsPath(temp_file, buf->tmppath);
lyxerr[Debug::GRAPHICS]
Index: src/support/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/ChangeLog,v
retrieving revision 1.287
diff -u -p -r1.287 ChangeLog
--- src/support/ChangeLog 16 Dec 2004 01:03:34 -0000 1.287
+++ src/support/ChangeLog 16 Dec 2004 16:46:10 -0000
@@ -1,5 +1,11 @@
2004-12-16 Angus Leeming <[EMAIL PROTECTED]>
+ * filename.C (mangledFilename): Given a Windows-style path, don't
+ forget to mangle the drive letter too when generating a unique
+ temporary file name.
+
+2004-12-16 Angus Leeming <[EMAIL PROTECTED]>
+
* mkdir.C: move the HAVE_MKDIR conditional code out of config.h
and into here.
Index: src/support/filename.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/filename.C,v
retrieving revision 1.10
diff -u -p -r1.10 filename.C
--- src/support/filename.C 7 Nov 2004 13:22:51 -0000 1.10
+++ src/support/filename.C 16 Dec 2004 16:46:10 -0000
@@ -86,6 +86,13 @@ string const FileName::mangledFilename()
mname = subst(mname, ".", "_");
// Add the extension back on
mname = ChangeExtension(mname, GetExtension(name_));
+
+#if defined(__CYGWIN__) || defined(__CYGWIN32__) || defined(_WIN32)
+ // Mangle the drive letter in a Windows-style path.
+ if (mname.size() >= 2 && mname[1] == ':')
+ mname[1] = '_';
+#endif
+
// Prepend a counter to the filename. This is necessary to make
// the mangled name unique.
static int counter = 0;