Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gmsh
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Larry Price
gmsh
Commits
d71d2045
Commit
d71d2045
authored
12 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
try to find client executable in same directory as argv0
this amkes it easier to ship bundles (e.g. gmsh+getdp)
parent
29e58385
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
Common/CommandLine.cpp
+1
-0
1 addition, 0 deletions
Common/CommandLine.cpp
Common/Context.h
+1
-0
1 addition, 0 deletions
Common/Context.h
Fltk/onelabGroup.cpp
+42
-14
42 additions, 14 deletions
Fltk/onelabGroup.cpp
with
44 additions
and
14 deletions
Common/CommandLine.cpp
+
1
−
0
View file @
d71d2045
...
@@ -268,6 +268,7 @@ void GetOptions(int argc, char *argv[])
...
@@ -268,6 +268,7 @@ void GetOptions(int argc, char *argv[])
#if defined(HAVE_PARSER)
#if defined(HAVE_PARSER)
if
(
argc
&&
argv
){
if
(
argc
&&
argv
){
CTX
::
instance
()
->
argv0
=
std
::
string
(
argv
[
0
]);
// parse session and option file (if argc/argv is not provided skip this
// parse session and option file (if argc/argv is not provided skip this
// step: this is usually what is expected when using Gmsh as a library)
// step: this is usually what is expected when using Gmsh as a library)
ParseFile
(
CTX
::
instance
()
->
homeDir
+
CTX
::
instance
()
->
sessionFileName
,
true
);
ParseFile
(
CTX
::
instance
()
->
homeDir
+
CTX
::
instance
()
->
sessionFileName
,
true
);
...
...
This diff is collapsed.
Click to expand it.
Common/Context.h
+
1
−
0
View file @
d71d2045
...
@@ -79,6 +79,7 @@ class CTX {
...
@@ -79,6 +79,7 @@ class CTX {
std
::
string
bgmFileName
,
outputFileName
,
defaultFileName
,
tmpFileName
;
std
::
string
bgmFileName
,
outputFileName
,
defaultFileName
,
tmpFileName
;
std
::
string
sessionFileName
,
optionsFileName
,
errorFileName
;
std
::
string
sessionFileName
,
optionsFileName
,
errorFileName
;
std
::
string
meshStatReportFileName
;
std
::
string
meshStatReportFileName
;
std
::
string
argv0
;
// the home directory
// the home directory
std
::
string
homeDir
;
std
::
string
homeDir
;
// file history
// file history
...
...
This diff is collapsed.
Click to expand it.
Fltk/onelabGroup.cpp
+
42
−
14
View file @
d71d2045
...
@@ -11,6 +11,7 @@
...
@@ -11,6 +11,7 @@
typedef
unsigned
long
intptr_t
;
typedef
unsigned
long
intptr_t
;
#endif
#endif
#include
<ctype.h>
#include
"GmshMessage.h"
#include
"GmshMessage.h"
#include
"onelab.h"
#include
"onelab.h"
#include
"gmshLocalNetworkClient.h"
#include
"gmshLocalNetworkClient.h"
...
@@ -864,20 +865,47 @@ static void onelab_choose_executable_cb(Fl_Widget *w, void *data)
...
@@ -864,20 +865,47 @@ static void onelab_choose_executable_cb(Fl_Widget *w, void *data)
#if defined(WIN32)
#if defined(WIN32)
pattern
+=
".exe"
;
pattern
+=
".exe"
;
#endif
#endif
const
char
*
old
=
0
;
if
(
!
c
->
getExecutable
().
empty
())
old
=
c
->
getExecutable
().
c_str
();
if
(
!
w
){
std
::
string
exe
=
""
;
const
char
*
old
=
fl_close
;
if
(
!
w
){
// we entered here automatically because no executable is given
// try to find an executable automatically (this is really useful for
// beginners)
if
(
CTX
::
instance
()
->
argv0
.
size
()){
std
::
vector
<
std
::
string
>
split
=
SplitFileName
(
CTX
::
instance
()
->
argv0
);
std
::
string
name
=
c
->
getName
();
for
(
unsigned
int
i
=
0
;
i
<
name
.
size
();
i
++
)
name
[
i
]
=
tolower
(
name
[
i
]);
std
::
string
path
=
split
[
0
]
+
name
;
#if defined(WIN32)
path
+=
".exe"
;
#endif
if
(
!
StatFile
(
path
)){
exe
=
path
;
Msg
::
Info
(
"Automatically found %s executable: %s"
,
c
->
getName
().
c_str
(),
exe
.
c_str
());
}
}
if
(
exe
.
empty
()){
const
char
*
o
=
fl_close
;
fl_close
=
"OK"
;
fl_close
=
"OK"
;
fl_message
(
"This appears to be the first time you are trying to run %s.
\n\n
"
fl_message
(
"This appears to be the first time you are trying to run %s.
\n\n
"
"Please select the path to the executable."
,
c
->
getName
().
c_str
());
"Please select the path to the executable."
,
c
->
getName
().
c_str
());
fl_close
=
old
;
fl_close
=
o
;
}
}
}
if
(
exe
.
empty
()){
const
char
*
old
=
0
;
if
(
c
->
getExecutable
().
size
())
old
=
c
->
getExecutable
().
c_str
();
std
::
string
title
=
"Choose location of "
+
c
->
getName
()
+
" executable"
;
std
::
string
title
=
"Choose location of "
+
c
->
getName
()
+
" executable"
;
if
(
fileChooser
(
FILE_CHOOSER_SINGLE
,
title
.
c_str
(),
pattern
.
c_str
(),
old
)){
if
(
fileChooser
(
FILE_CHOOSER_SINGLE
,
title
.
c_str
(),
pattern
.
c_str
(),
old
))
std
::
string
exe
=
fileChooserGetName
(
1
);
exe
=
fileChooserGetName
(
1
);
}
if
(
exe
.
size
()){
c
->
setExecutable
(
exe
);
c
->
setExecutable
(
exe
);
if
(
c
->
getIndex
()
>=
0
&&
c
->
getIndex
()
<
5
)
if
(
c
->
getIndex
()
>=
0
&&
c
->
getIndex
()
<
5
)
opt_solver_executable
(
c
->
getIndex
(),
GMSH_SET
,
exe
);
opt_solver_executable
(
c
->
getIndex
(),
GMSH_SET
,
exe
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment