Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix relative paths, when project is on unc path
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@13397 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Apr 26, 2010
1 parent 6eab254 commit 32096f5
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/core/qgsproject.cpp
Expand Up @@ -1334,6 +1334,7 @@ QString QgsProject::readPath( QString src ) const
{
#if defined(Q_OS_WIN)
if ( src.startsWith( "\\\\" ) ||
src.startsWith( "//" ) ||
( src[0].isLetter() && src[1] == ':' ) )
{
// UNC or absolute path
Expand Down Expand Up @@ -1371,11 +1372,21 @@ QString QgsProject::readPath( QString src ) const
#if defined(Q_OS_WIN)
srcPath.replace( "\\", "/" );
projPath.replace( "\\", "/" );

bool uncPath = projPath.startsWith( "//" );
#endif

QStringList srcElems = srcPath.split( "/", QString::SkipEmptyParts );
QStringList projElems = projPath.split( "/", QString::SkipEmptyParts );

#if defined(Q_OS_WIN)
if ( uncPath )
{
projElems.insert( 0, "" );
projElems.insert( 0, "" );
}
#endif

// remove project file element
projElems.removeLast();

Expand Down

0 comments on commit 32096f5

Please sign in to comment.