Index: /issm/trunk-jpl/src/m/mesh/planet/gmsh/gmshplanet.m
===================================================================
--- /issm/trunk-jpl/src/m/mesh/planet/gmsh/gmshplanet.m	(revision 25746)
+++ /issm/trunk-jpl/src/m/mesh/planet/gmsh/gmshplanet.m	(revision 25747)
@@ -15,6 +15,23 @@
 %      md.mesh=gmshplanet('radius',6000,'resolution',100);
 
+	%Find path to gmsh
+	paths = {...
+		[issmdir() 'bin/gmsh'],...
+		[issmdir() 'externalpackages/gmsh/install/gmsh']...
+	};
+	disp(paths{1})
+	gmshpath = '';
+	for i=paths
+		if exist(i{1},'file'),
+			gmshpath = i{1};
+			break;
+		end
+	end
+	if isempty(gmshpath),
+		error('gmsh not found, make sure it is properly installed');
+	end
+
 	% Get Gmsh version
-	[s,r]=system(['gmsh -info 2>&1 | command grep ''Version'' | sed -e ''s/Version[[:blank:]]*:[[:blank:]]//'' | cut -d ''.'' -f1']);
+	[s,r]=system([gmshpath ' -info 2>&1 | command grep ''Version'' | sed -e ''s/Version[[:blank:]]*:[[:blank:]]//'' | cut -d ''.'' -f1']);
 	if s~=0,
 		error(r);
@@ -119,17 +136,4 @@
 	end
 
-	%Find path to gmsh
-	paths = {[issmdir() '/bin/gmsh'],[issmdir() '/externalpackages/gmsh/install/gmsh']};
-	gmshpath = '';
-	for i=paths
-		if exist(i{1},'file'),
-			gmshpath = i{1};
-			break;
-		end
-	end
-	if isempty(gmshpath),
-		error('gmsh not found, make sure it is properly installed');
-	end
-
 	% Call gmsh
 	%
