Revision 1664

tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/CQPSearchEngine.java (revision 1664)
73 73
		state = false;
74 74
		// test if must-have properties for CWB are set
75 75

  
76
		String reg_path = ""; // new way that concats registry of loaded corpus
77
		String path_separator = System.getProperty("path.separator");
78
		File wl = Toolbox.workspace.getLocation();
79
		if (wl == null) {
80
			Log.severe("Error: Toolbox is not correctly initialized. Aborting CQP engine start...");
81
			return false;
82
		}
83
		for (File binDir : wl.listFiles(IOUtils.HIDDENFILE_FILTER)) {
84
			if (!binDir.isDirectory()) continue;
85
			if (binDir.getName().startsWith(".")) continue;
86
			if (binDir.getName().startsWith("~")) continue;
87

  
88
			File registryDir = new File(binDir, "registry");
89
			if (!registryDir.isDirectory()) continue;
90

  
91
			File[] files = registryDir.listFiles(IOUtils.HIDDENFILE_FILTER);
92
			if (files != null && files.length > 0) {
93
				reg_path += path_separator + registryDir.getAbsolutePath();
94
				for (File registryFile : files) {
95
					if (registryFile.isHidden()) continue;
96
					if (registryFile.isDirectory()) continue;
97

  
98
					File dataDirectory = new File(binDir, "data/"+registryFile.getName().toUpperCase());
99
					if (!dataDirectory.exists())dataDirectory = new File(binDir, "data"); // eventual old corpus
100
					try {
101
						PatchCwbRegistry.patch(registryFile, dataDirectory);
102
					} catch (IOException e) {
103
						Log.severe(TXMCoreMessages.bind("Error while updating registry file {0}.", registryFile));
104
						Log.printStackTrace(e);
105
						return false;
106
					}
107
				}
108
			}
109
		}
110
		if (reg_path.length() > 0) reg_path = reg_path.substring(path_separator.length()); // remove first path_separator
111
		reg_path = reg_path.replace("\\\\", "//"); // fix the UNC paths for mingw
112

  
76
//		String reg_path = ""; // new way that concats registry of loaded corpus
77
//		String path_separator = System.getProperty("path.separator");
78
//		File wl = Toolbox.workspace.getLocation();
79
//		if (wl == null) {
80
//			Log.severe("Error: Toolbox is not correctly initialized. Aborting CQP engine start...");
81
//			return false;
82
//		}
83
//		for (File binDir : wl.listFiles(IOUtils.HIDDENFILE_FILTER)) {
84
//			if (!binDir.isDirectory()) continue;
85
//			if (binDir.getName().startsWith(".")) continue;
86
//			if (binDir.getName().startsWith("~")) continue;
87
//
88
//			File registryDir = new File(binDir, "registry");
89
//			if (!registryDir.isDirectory()) continue;
90
//
91
//			File[] files = registryDir.listFiles(IOUtils.HIDDENFILE_FILTER);
92
//			if (files != null && files.length > 0) {
93
//				reg_path += path_separator + registryDir.getAbsolutePath();
94
//				for (File registryFile : files) {
95
//					if (registryFile.isHidden()) continue;
96
//					if (registryFile.isDirectory()) continue;
97
//
98
//					File dataDirectory = new File(binDir, "data/"+registryFile.getName().toUpperCase());
99
//					if (!dataDirectory.exists())dataDirectory = new File(binDir, "data"); // eventual old corpus
100
//					try {
101
//						PatchCwbRegistry.patch(registryFile, dataDirectory);
102
//					} catch (IOException e) {
103
//						Log.severe(TXMCoreMessages.bind("Error while updating registry file {0}.", registryFile));
104
//						Log.printStackTrace(e);
105
//						return false;
106
//					}
107
//				}
108
//			}
109
//		}
110
//		if (reg_path.length() > 0) reg_path = reg_path.substring(path_separator.length()); // remove first path_separator
111
//		reg_path = reg_path.replace("\\\\", "//"); // fix the UNC paths for mingw
112
//
113 113
		String init_path = CQPLibPreferences.getInstance().getString(CQPLibPreferences.CQI_SERVER_PATH_TO_INIT_FILE);
114 114
		if (init_path.length() > 0 && !new File(init_path).exists()) {
115 115
			Log.warning(TXMCoreMessages.bind("Warning: the given CQP init file path can not be found in {0}.", init_path));
116 116
			init_path = null;
117 117
		}
118 118

  
119

  
120

  
121 119
		if (!remote) {
122 120

  
123 121
			if (!useNetCQi) {
124 122
				try {
125
					cqiServer = new MemCqiServer(reg_path, 
123
					cqiServer = new MemCqiServer("", 
126 124
							init_path, 
127 125
							CQPLibPreferences.getInstance().getString(CQPLibPreferences.CQI_SERVER_ADDITIONAL_OPTIONS)
128 126
							+ " -P " + CQPLibPreferences.getInstance().getString(CQPLibPreferences.CQI_SERVER_PORT), //$NON-NLS-1$
......
143 141
				//				}
144 142

  
145 143
				cqiServer = new NetCqiServer(exec_path,
146
						reg_path, 
144
						"", 
147 145
						init_path, 
148 146
						CQPLibPreferences.getInstance().getString(CQPLibPreferences.CQI_SERVER_ADDITIONAL_OPTIONS)
149 147
						+ " -P " + CQPLibPreferences.getInstance().getString(CQPLibPreferences.CQI_SERVER_PORT), //$NON-NLS-1$
tmp/org.txm.treetagger.core.win32/build.properties (revision 1664)
3 3
bin.includes = META-INF/,\
4 4
               .,\
5 5
               res/
6
qualifier=svn
tmp/org.txm.treetagger.core.linux/build.properties (revision 1664)
4 4
               .,\
5 5
               res/
6 6
root.linux.gtk.x86_64.permissions.755=res/linux/,res/linux/bin,res/linux/cmd
7
qualifier=svn
tmp/org.txm.treetagger.core.models/build.properties (revision 1664)
3 3
bin.includes = META-INF/,\
4 4
               .,\
5 5
               res/models/
6
qualifier=svn
tmp/org.txm.statsengine.r.core.macosx/build.properties (revision 1664)
3 3
bin.includes = META-INF/,\
4 4
               .,\
5 5
               res/
6
qualifier=svn
tmp/org.txm.treetagger.core.macosx/build.properties (revision 1664)
3 3
bin.includes = META-INF/,\
4 4
               .
5 5
root.macosx.cocoa.x86_64.permissions.755=res/macosx/,res/macosx/bin,res/macosx/cmd
6
qualifier=svn
tmp/org.txm.statsengine.r.core.win32/build.properties (revision 1664)
5 5
               res/
6 6
bin.excludes = res/win32/library/BH/,\
7 7
               res/win32/library/stringi/
8
qualifier=svn
tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/RWorkspace.java (revision 1664)
334 334
		boolean isRServerOk;
335 335
		
336 336
		Log.fine(TXMCoreMessages.bind("RWorkspace.initRserve(): checking file existence of {0}...", pathToRExecutable)); //$NON-NLS-1$
337

  
337
		
338 338
		File execFile = new File(pathToRExecutable);
339 339
		if (!execFile.exists() || pathToRExecutable == null || pathToRExecutable.length() == 0) {
340
			isRServerOk = StartRserve.checkLocalRserve(port, debug, rargs, rServeArgs);
341
			if (!isRServerOk) {
340
			//isRServerOk = StartRserve.checkLocalRserve(port, debug, rargs, rServeArgs);
341
		//	if (!isRServerOk) {
342 342
				throw new RWorkspaceException(RCoreMessages.error_rservePathNotSet); 
343
			}
343
		//	}
344 344
		} else {
345 345
			isRServerOk = StartRserve.launchRserve(pathToRExecutable, port, debug, rargs, rServeArgs);
346 346
			// System.out.println("ap launchRserve");
tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/StartRserve.java (revision 1664)
198 198
			return true;
199 199
		}
200 200
		// Windows OS
201
		if (OSDetector.isFamilyWindows()) {
202
			// System.out.println("Windows: query registry to find where R is installed ...");
203
			String installPath = null;
204
			try {
205
				Process rp = Runtime.getRuntime().exec("reg query HKLM\\Software\\R-core\\R"); //$NON-NLS-1$
206
				StreamHog regHog = new StreamHog(rp.getInputStream(), true);
207
				rp.waitFor();
208
				regHog.join();
209
				installPath = regHog.getInstallPath();
210
			} catch (Exception rge) {
211
				Log.severe(RCoreMessages.error_failedToRunREG + rge);
212
				return false;
213
			}
214
			if (installPath == null) {
215
				Log.severe(RCoreMessages.error_youNeedRSoftware);
216
				return false;
217
			}
218
			// System.out.println(" Found R in : "+installPath +
219
			// "\\bin\\R.exe");
220
			return launchRserve(installPath + "\\bin\\R.exe", port, debug, rargs, rServeArgs); //$NON-NLS-1$
221
		}
201
//		if (OSDetector.isFamilyWindows()) {
202
//			// System.out.println("Windows: query registry to find where R is installed ...");
203
//			String installPath = null;
204
//			try {
205
//				Process rp = Runtime.getRuntime().exec("reg query HKLM\\Software\\R-core\\R"); //$NON-NLS-1$
206
//				StreamHog regHog = new StreamHog(rp.getInputStream(), true);
207
//				rp.waitFor();
208
//				regHog.join();
209
//				installPath = regHog.getInstallPath();
210
//			} catch (Exception rge) {
211
//				Log.severe(RCoreMessages.error_failedToRunREG + rge);
212
//				return false;
213
//			}
214
//			if (installPath == null) {
215
//				Log.severe(RCoreMessages.error_youNeedRSoftware);
216
//				return false;
217
//			}
218
//			// System.out.println(" Found R in : "+installPath +
219
//			// "\\bin\\R.exe");
220
//			return launchRserve(installPath + "\\bin\\R.exe", port, debug, rargs, rServeArgs); //$NON-NLS-1$
221
//		}
222 222

  
223 223
		Log.fine(RCoreMessages.info_tryingToStartRWithRPath);
224 224
		if (launchRserve("R", port, debug, rargs, rServeArgs)) { //$NON-NLS-1$

Also available in: Unified diff