View Issue Details

IDProjectCategoryView StatusLast Update
0002272ScribusOS-Win32public2005-09-25 20:52
Reporterjghali Assigned Tofschmid  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
PlatformWindowsOSWindowsOS Version2000 SP4
Product Version1.3.1cvs 
Fixed in Version1.3.1cvs 
Summary0002272: Modified Path2Relative function for win32 compatibility
DescriptionSome code has been added to check that paths are located on same drive.
TagsNo tags attached.
Attached Files
Path2Relative_win32compat2.diff (1,549 bytes)   
Index: util.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/util.cpp,v
retrieving revision 1.52.2.115
diff -u -r1.52.2.115 util.cpp
--- util.cpp	20 Aug 2005 10:36:52 -0000	1.52.2.115
+++ util.cpp	21 Aug 2005 22:09:16 -0000
@@ -700,12 +715,30 @@
 QString Path2Relative(QString Path)
 {
 	QString	Ndir = "";
-	QStringList Pdir = QStringList::split("/", QDir::currentDirPath());
+	QStringList Pdir;
 	QFileInfo Bfi = QFileInfo(Path);
-	QStringList Bdir = QStringList::split("/", Bfi.dirPath(true));
+	QStringList Bdir;
 	bool end = true;
 	uint dcoun = 0;
 	uint dcoun2 = 0;
+
+#ifndef _WIN32
+	Pdir = QStringList::split("/", QDir::currentDirPath());
+	Bdir = QStringList::split("/", Bfi.dirPath(true));
+#else
+	// On win32, file systems are case insensitive
+	Pdir = QStringList::split("/", QDir::currentDirPath().lower());
+	Bdir = QStringList::split("/", Bfi.dirPath(true).lower());
+	// We must check that both path are located on same drive
+	if( Pdir.size() > 0 && Bdir.size() > 0 )
+	{
+		QString drive = Bdir.front();
+		QString currentDrive = Pdir.front();
+		if( drive != currentDrive ) 
+			return Path;
+	}
+#endif
+
 	while (end)
 	{
 		if (Pdir[dcoun] == Bdir[dcoun])
@@ -716,6 +749,11 @@
 			break;
 	}
 	dcoun2 = dcoun;
+
+#ifdef _WIN32
+	Bdir = QStringList::split("/", Bfi.dirPath(true));
+#endif
+
 	for (uint ddx2 = dcoun; ddx2 < Pdir.count(); ddx2++)
 		Ndir += "../";
 	for (uint ddx = dcoun2; ddx < Bdir.count(); ddx++)

Patch

Relationships

child of 0000015 closedjghali Windows Port 

Activities

jghali

2005-08-22 18:13

administrator   ~0006197

Uploaded a new patch. It takes now into account case insensitivity on win32

Issue History

Date Modified Username Field Change
2005-07-20 22:35 jghali New Issue
2005-07-20 22:35 jghali File Added: Path2Relative_win32compat.diff
2005-07-21 08:20 mhanski Relationship added child of 0000015
2005-08-22 18:12 jghali File Added: Path2Relative_win32compat2.diff
2005-08-22 18:13 jghali File Deleted: Path2Relative_win32compat.diff
2005-08-22 18:13 jghali Note Added: 0006197
2005-08-24 23:57 cbradney Status new => assigned
2005-08-24 23:57 cbradney Assigned To => fschmid
2005-08-25 19:26 fschmid Status assigned => resolved
2005-08-25 19:26 fschmid Fixed in Version => 1.3.1cvs
2005-08-25 19:26 fschmid Resolution open => fixed
2005-08-28 23:35 jghali Status resolved => closed
2005-09-25 20:52 cbradney Category Internal => Win32
2014-10-08 18:38 Kunda Category Win32 => OS-Win32