Skip to content

Commit 7d8c33c

Browse files
author
jef
committedFeb 8, 2009
merge r10130 in version 1.0
git-svn-id: http://svn.osgeo.org/qgis/branches/Version-1_0@10131 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent db95a4f commit 7d8c33c

File tree

3 files changed

+20
-47
lines changed

3 files changed

+20
-47
lines changed
 

‎src/plugins/grass/qgsgrassmodule.cpp

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -87,19 +87,19 @@ QString QgsGrassModule::findExec( QString file )
8787

8888
if ( QFile::exists( file ) ) return file; // full path
8989

90-
// Search for module
90+
#ifdef WIN32
91+
// On windows try .bat first
9192
for ( QStringList::iterator it = mExecPath.begin();
9293
it != mExecPath.end(); ++it )
9394
{
94-
QString full = *it + "/" + file;
95+
QString full = *it + "/" + file + ".bat";
9596
if ( QFile::exists( full ) )
9697
{
9798
return full;
9899
}
99100
}
100101

101-
// Not found try with .exe
102-
#ifdef WIN32
102+
// .exe next
103103
for ( QStringList::iterator it = mExecPath.begin();
104104
it != mExecPath.end(); ++it )
105105
{
@@ -109,8 +109,21 @@ QString QgsGrassModule::findExec( QString file )
109109
return full;
110110
}
111111
}
112+
113+
// and then try if it's a script (w/o extension)
112114
#endif
113115

116+
// Search for module
117+
for ( QStringList::iterator it = mExecPath.begin();
118+
it != mExecPath.end(); ++it )
119+
{
120+
QString full = *it + "/" + file;
121+
if ( QFile::exists( full ) )
122+
{
123+
return full;
124+
}
125+
}
126+
114127
return QString();
115128
}
116129

@@ -131,24 +144,7 @@ QStringList QgsGrassModule::execArguments( QString module )
131144
return arguments;
132145
}
133146

134-
#if defined(WIN32)
135-
QFileInfo fi( exe );
136-
if ( fi.isExecutable() )
137-
{
138-
arguments.append( exe );
139-
}
140-
else // script
141-
{
142-
QString cmd = getShortPath( QgsApplication::applicationDirPath() ) + "/msys/bin/sh";
143-
arguments.append( cmd );
144-
145-
// Important! Otherwise it does not find DLL even if it is in PATH
146-
arguments.append( "--login" );
147-
arguments.append( exe );
148-
}
149-
#else
150147
arguments.append( exe );
151-
#endif
152148

153149
return arguments;
154150
}

‎src/plugins/grass/qgsgrassshell.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ QgsGrassShell::QgsGrassShell( QgsGrassTools *tools,
183183
setsid();
184184
seteuid( 0 );
185185

186-
int fd = open(( char* ) slaveName.ascii(), O_RDWR );
186+
int fd = ::open(( char* ) slaveName.ascii(), O_RDWR );
187187
if ( fd < 0 )
188188
{
189189
QMessageBox::warning( 0, "Warning", "Cannot open slave file "

‎src/plugins/grass/qgsgrasstools.cpp

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -171,31 +171,8 @@ void QgsGrassTools::runModule( QString name )
171171
#endif
172172

173173
#ifdef WIN32
174-
// Run MSYS if available
175-
// Note: I was not able to run cmd.exe and command.com
176-
// with QProcess
177-
178-
QString msysPath = appDir() + "/msys/bin/rxvt.exe";
179-
QString myArguments = "-backspacekey ^H -sl 2500 -fg white -bg black -sr -fn Courier-16 -tn msys -geometry 80x25 -e /bin/sh --login -i";
180-
QFile file( msysPath );
181-
182-
if ( !file.exists() )
183-
{
184-
QMessageBox::warning( 0, tr( "Warning" ),
185-
tr( "Cannot find MSYS (" ) + msysPath + ")" );
186-
}
187-
else
188-
{
189-
QProcess *proc = new QProcess( this );
190-
//allow msys to exist in a path with spaces
191-
msysPath = "\"" + msysPath + "\"" ;
192-
proc->start( msysPath + " " + myArguments );
193-
proc->waitForStarted();
194-
if ( proc->state() != QProcess::Running )
195-
{
196-
QMessageBox::warning( 0, "Warning",
197-
"Cannot start MSYS (" + msysPath + ")" );
198-
}
174+
if( !QProcess::startDetached( getenv("COMSPEC") ) ) {
175+
QMessageBox::warning( 0, "Warning", tr("Cannot start command shell (%1)").arg( getenv("COMSPEC") ) );
199176
}
200177
return;
201178
#else

0 commit comments

Comments
 (0)
Please sign in to comment.