Commit 61064ce2962ff6d648c0e7c04dc4303e69ec49d9

Authored by Perry Werneck
1 parent fa3b423b
Exists in develop

Scanning for more paths.

src/objects/application/application.c
... ... @@ -278,9 +278,41 @@ static void pw3270Application_init(pw3270Application *app) {
278 278 g_settings_bind(app->settings, "ui-style", app, "ui-style", G_SETTINGS_BIND_DEFAULT);
279 279 }
280 280  
  281 + // Load plugins from registry
  282 + /*
281 283 {
282   - lib3270_autoptr(char) plugin_path = lib3270_build_data_filename("plugins",NULL);
283   - pw3270_load_plugins_from_path(app, plugin_path);
  284 + HKEY hKey;
  285 + DWORD cbData = 4096;
  286 + g_autofree gchar *path = g_malloc0(cbData);
  287 +
  288 + if(RegOpenKeyEx(HKEY_LOCAL_MACHINE,G_STRINGIFY(PRODUCT_NAME)"\\plugin",0,KEY_READ,&hKey) == ERROR_SUCCESS) {
  289 + DWORD dwRet = RegQueryValueEx(hKey,"path",NULL,NULL,(LPBYTE) path, &cbData);
  290 + if(dwRet != ERROR_SUCCESS && *path) {
  291 + pw3270_load_plugins_from_path(app, path);
  292 + }
  293 + CloseHandle(hKey);
  294 + }
  295 + }
  296 + */
  297 +
  298 + // Load plugin from default paths.
  299 + {
  300 + const char *paths[] = {
  301 + "plugins",
  302 + G_STRINGIFY(PRODUCT_NAME) "-plugins",
  303 + "lib/plugins",
  304 + "lib/" G_STRINGIFY(PRODUCT_NAME) "-plugins",
  305 + };
  306 + size_t ix;
  307 +
  308 + for(ix = 0; ix < G_N_ELEMENTS(paths);ix++) {
  309 + lib3270_autoptr(char) path = lib3270_build_data_filename("plugins",NULL);
  310 + if(g_file_test(path,G_FILE_TEST_IS_DIR)) {
  311 + pw3270_load_plugins_from_path(app, path);
  312 + break;
  313 + }
  314 + }
  315 +
284 316 }
285 317  
286 318 #elif defined(__APPLE__)
... ...
src/objects/application/plugins.c
... ... @@ -65,6 +65,10 @@ void pw3270_load_plugins_from_path(pw3270Application *app, const char *path) {
65 65  
66 66 }
67 67  
  68 + } else {
  69 +
  70 + g_warning("Can't load plugins from %s: %s",path,"Invalid path");
  71 +
68 72 }
69 73  
70 74 }
... ...
win/ci-build.sh
... ... @@ -40,7 +40,7 @@ cd $(dirname $(dirname $(readlink -f ${0})))
40 40 # Install pre-reqs
41 41 #
42 42 echo "Installing pre-reqs..."
43   -pacman -U --noconfirm *.pkg.tar.zst || die "pacman failure"
  43 +pacman -U --noconfirm *.pkg.tar.zst || die "pre-reqs failure"
44 44  
45 45 #
46 46 # Build
... ...