Skip to content

Commit

Permalink
Win port
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@4675 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
rblazek committed Jan 13, 2006
1 parent fbe1082 commit 61ba5de
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 6 deletions.
21 changes: 21 additions & 0 deletions src/providers/grass/Makefile.win
@@ -0,0 +1,21 @@
QGTOP=../../../

LDADD = .libs/libqgisgrass.a $(PLUGIN_LIBS) $(GRASS_LIB)

OBJECTS = grassprovider_la-provider.o

PROVIDER = .libs/grassprovider.dll

all: objects $(PROVIDER)

objects:
$(MAKE) -f Makefile

$(PROVIDER): $(OBJECTS)
$(CXX) -shared -o $@ $(OBJECTS) $(LDADD)
$(STRIP) $@

install: all
$(INSTALL) -m 755 $(PROVIDER) $(prefix)/lib/qgis/grassprovider.dll

include ../../../Makefile.win.rules
18 changes: 14 additions & 4 deletions src/providers/grass/qgsgrass.cpp
Expand Up @@ -56,12 +56,18 @@ void QgsGrass::init( void ) {

// Add path to GRASS modules
// TODO: do that portable
#ifdef WIN32
QString sep = ";";
#else
QString sep = ":";

#endif
QString gisBase = getenv("GISBASE");
QString path = "PATH=" + gisBase + "/bin";
path.append ( ":" + gisBase + "/scripts" );
path.append ( sep + gisBase + "/scripts" );

QString p = getenv ("PATH");
path.append ( ":" + p );
path.append ( sep + p );

#ifdef QGISDEBUG
std::cerr << "set PATH: " << path.toLocal8Bit().data() << std::endl;
Expand Down Expand Up @@ -135,7 +141,7 @@ int QgsGrass::initialized = 0;

bool QgsGrass::active = 0;

QgsGrass::ERROR QgsGrass::error = QgsGrass::OK;
QgsGrass::GERROR QgsGrass::error = QgsGrass::OK;

QString QgsGrass::error_message;

Expand Down Expand Up @@ -208,13 +214,17 @@ QString QgsGrass::openMapset ( QString gisdbase, QString location, QString mapse
#ifdef QGISDEBUG
std::cerr << "status = " << status << std::endl;
#endif

// TODO WIN32 (lock.exe does not work properly?)
#ifndef WIN32
if ( status > 0 ) return "Mapset is already in use.";
#endif

// Create temporary directory
QFileInfo info ( mapsetPath );
QString user = info.owner();

mTmp = "/tmp/grass6-" + user + "-" + QString::number(pid);
mTmp = QDir::tempPath () + "/grass6-" + user + "-" + QString::number(pid);
QDir dir ( mTmp );
if ( dir.exists() )
{
Expand Down
4 changes: 2 additions & 2 deletions src/providers/grass/qgsgrass.h
Expand Up @@ -60,7 +60,7 @@ class QgsGrass {
static void setMapset( QString gisdbase, QString location, QString mapset);

//! Error codes returned by GetError()
enum ERROR { OK, /*!< OK. No error. */
enum GERROR { OK, /*!< OK. No error. */
WARNING, /*!< Warning, non fatal error. Should be printed by application. */
FATAL /*!< Fatal error. Function faild. */
};
Expand Down Expand Up @@ -95,7 +95,7 @@ class QgsGrass {
static QString defaultMapset;

/* last error in GRASS libraries */
static ERROR error; // static, because used in constructor
static GERROR error; // static, because used in constructor
static QString error_message;

static int error_routine ( char *msg, int fatal); // static because pointer to this function is set later
Expand Down

0 comments on commit 61ba5de

Please sign in to comment.