Skip to content

Commit

Permalink
fix windows build
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Feb 20, 2012
1 parent 411aff6 commit 0a81f65
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 22 deletions.
14 changes: 0 additions & 14 deletions ms-windows/osgeo4w/package-nightly.cmd
Expand Up @@ -155,20 +155,6 @@ tar -C %OSGEO4W_ROOT% -cjf %PACKAGENAME%-%VERSION%-%PACKAGE%.tar.bz2 ^
etc/preremove/%PACKAGENAME%.bat ^
>>%LOG% 2>&1
if errorlevel 1 goto error

REM tar -C %OSGEO4W_ROOT% -cjf %PACKAGENAME%-grass-%VERSION%-%PACKAGE%.tar.bz2 ^
REM --exclude-from exclude ^
REM "apps/%PACKAGENAME%/themes/classic/grass" ^
REM "apps/%PACKAGENAME%/themes/default/grass" ^
REM "apps/%PACKAGENAME%/themes/gis/grass" ^
REM "apps/%PACKAGENAME%/grass" ^
REM "apps/%PACKAGENAME%/bin/qgisgrass.dll" ^
REM "apps/%PACKAGENAME%/plugins/grassrasterprovider.dll" ^
REM "apps/%PACKAGENAME%/plugins/grassplugin.dll" ^
REM "apps/%PACKAGENAME%/plugins/grassprovider.dll" ^
REM >>%LOG% 2>&1
REM if errorlevel 1 goto error

goto end

:error
Expand Down
7 changes: 0 additions & 7 deletions ms-windows/osgeo4w/package.cmd
Expand Up @@ -199,9 +199,6 @@ if errorlevel 1 goto error
tar -C %OSGEO4W_ROOT% -cjf %PACKAGENAME%-%VERSION%-%PACKAGE%.tar.bz2 ^
--exclude-from exclude ^
--exclude "*.pyc" ^
--exclude apps/%PACKAGENAME%/themes/classic/grass ^
--exclude apps/%PACKAGENAME%/themes/default/grass ^
--exclude apps/%PACKAGENAME%/themes/gis/grass ^
"apps/%PACKAGENAME%/bin/qgis.exe" ^
"apps/%PACKAGENAME%/bin/qgis.reg.tmpl" ^
"apps/%PACKAGENAME%/i18n/" ^
Expand Down Expand Up @@ -230,7 +227,6 @@ tar -C %OSGEO4W_ROOT% -cjf %PACKAGENAME%-%VERSION%-%PACKAGE%.tar.bz2 ^
"apps/%PACKAGENAME%/python/" ^
"apps/%PACKAGENAME%/resources/context_help/" ^
"apps/%PACKAGENAME%/resources/qgis_help.db" ^
"apps/%PACKAGENAME%/themes/" ^
"bin/%PACKAGENAME%.bat.tmpl" ^
"etc/postinstall/%PACKAGENAME%.bat" ^
"etc/preremove/%PACKAGENAME%.bat" ^
Expand All @@ -240,9 +236,6 @@ if errorlevel 1 goto error
tar -C %OSGEO4W_ROOT% -cjf %PACKAGENAME%-grass-plugin-%VERSION%-%PACKAGE%.tar.bz2 ^
--exclude-from exclude ^
--exclude "*.pyc" ^
"apps/%PACKAGENAME%/themes/classic/grass" ^
"apps/%PACKAGENAME%/themes/default/grass" ^
"apps/%PACKAGENAME%/themes/gis/grass" ^
"apps/%PACKAGENAME%/grass" ^
"apps/%PACKAGENAME%/bin/qgisgrass.dll" ^
"apps/%PACKAGENAME%/plugins/grassrasterprovider.dll" ^
Expand Down
18 changes: 17 additions & 1 deletion src/providers/grass/qgsgrass.cpp
Expand Up @@ -450,9 +450,17 @@ QString GRASS_EXPORT QgsGrass::openMapset( QString gisdbase, QString location, Q
{
return QObject::tr( "%1 is not a GRASS mapset." ).arg( mapsetPath );
}
QString lock = mapsetPath + "/.gislock";

#ifndef _MSC_VER
int pid = getpid();
#else
int pid = GetCurrentProcessId();
#endif

QgsDebugMsg( QString( "pid = %1" ).arg( pid ) );

#ifndef Q_OS_WIN
QString lock = mapsetPath + "/.gislock";
QFile lockFile( lock );
QProcess *process = new QProcess();
QString lockProgram( gisBase + "/etc/lock" );
Expand Down Expand Up @@ -488,13 +496,17 @@ QString GRASS_EXPORT QgsGrass::openMapset( QString gisdbase, QString location, Q
QFileInfo dirInfo( mTmp );
if ( !dirInfo.isWritable() )
{
#ifndef Q_OS_WIN
lockFile.remove();
#endif
return QObject::tr( "Temporary directory %1 exists but is not writable" ).arg( mTmp );
}
}
else if ( !dir.mkdir( mTmp ) )
{
#ifndef Q_OS_WIN
lockFile.remove();
#endif
return QObject::tr( "Cannot create temporary directory %1" ).arg( mTmp );
}

Expand All @@ -508,7 +520,9 @@ QString GRASS_EXPORT QgsGrass::openMapset( QString gisdbase, QString location, Q
QFile out( mGisrc );
if ( !out.open( QIODevice::WriteOnly ) )
{
#ifndef Q_OS_WIN
lockFile.remove();
#endif
return QObject::tr( "Cannot create %1" ).arg( mGisrc );
}
QTextStream stream( &out );
Expand Down Expand Up @@ -566,12 +580,14 @@ QString GRASS_EXPORT QgsGrass::openMapset( QString gisdbase, QString location, Q

active = true;

#ifndef Q_OS_WIN
// Close old mapset
if ( mMapsetLock.length() > 0 )
{
QFile file( mMapsetLock );
file.remove();
}
#endif

mMapsetLock = lock;

Expand Down

0 comments on commit 0a81f65

Please sign in to comment.