summaryrefslogtreecommitdiffstats
path: root/src/io
diff options
context:
space:
mode:
authorPatrick Storz <eduard.braun2@gmx.de>2019-03-29 22:05:23 +0000
committerPatrick Storz <eduard.braun2@gmx.de>2019-03-29 22:05:23 +0000
commit622a199a829580e3b24fef60085ec8673bb1e2dd (patch)
tree7dddf755a2e261cc11ff5cc363804b0d159470d0 /src/io
parentFix for fb42d9e019e0b21c4d98cae0e8268d63087a2034 (diff)
downloadinkscape-622a199a829580e3b24fef60085ec8673bb1e2dd.tar.gz
inkscape-622a199a829580e3b24fef60085ec8673bb1e2dd.zip
Drop "RegistryTool" which is no longer in use.
Diffstat (limited to 'src/io')
-rw-r--r--src/io/CMakeLists.txt8
-rw-r--r--src/io/registrytool.cpp215
-rw-r--r--src/io/registrytool.h61
3 files changed, 0 insertions, 284 deletions
diff --git a/src/io/CMakeLists.txt b/src/io/CMakeLists.txt
index cef86f637..3a5d8aef2 100644
--- a/src/io/CMakeLists.txt
+++ b/src/io/CMakeLists.txt
@@ -32,13 +32,5 @@ set(io_SRC
http.h
)
-if(WIN32)
- # Sources for the inkscape executable on Windows.
- list(APPEND io_SRC
- registrytool.h
- registrytool.cpp
- )
-endif()
-
# add_inkscape_lib(io_LIB "${io_SRC}")
add_inkscape_source("${io_SRC}")
diff --git a/src/io/registrytool.cpp b/src/io/registrytool.cpp
deleted file mode 100644
index 169e49721..000000000
--- a/src/io/registrytool.cpp
+++ /dev/null
@@ -1,215 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/** \file
- * Inkscape registry tool
- *//*
- * Authors:
- * see git history
- * Bob Jamison
- * Copyright (C) 2005-2018 Authors
- *
- * Released under GNU GPL v2+, read the file 'COPYING' for more information.
- */
-
-#include "registrytool.h"
-
-#include <windows.h>
-#include <string>
-#include <cstdio>
-
-#include <glibmm/ustring.h>
-
-struct KeyTableEntry
-{
- HKEY key;
- int strlen;
- const char *str;
-};
-
-
-
-KeyTableEntry keyTable[] =
-{
- { HKEY_CLASSES_ROOT, 18, "HKEY_CLASSES_ROOT\\" },
- { HKEY_CURRENT_CONFIG, 20, "HKEY_CURRENT_CONFIG\\" },
- { HKEY_CURRENT_USER, 18, "HKEY_CURRENT_USER\\" },
- { HKEY_LOCAL_MACHINE, 19, "HKEY_LOCAL_MACHINE\\" },
- { HKEY_USERS, 11, "HKEY_USERS\\" },
- { NULL, 0, NULL }
-};
-
-
-bool RegistryTool::setStringValue(const Glib::ustring &keyNameArg,
- const Glib::ustring &valueName,
- const Glib::ustring &value)
-{
- Glib::ustring keyName = keyNameArg;
- bool ret = false;
-
- HKEY rootKey = HKEY_LOCAL_MACHINE; //default root
- //Trim out the root key if necessary
- for (KeyTableEntry *entry = keyTable; entry->key; entry++)
- {
- if (keyName.compare(0, entry->strlen, entry->str)==0)
- {
- rootKey = entry->key;
- keyName = keyName.substr(entry->strlen);
- }
- }
- //printf("trimmed string: '%s'\n", keyName.c_str());
-
- //Get or create the key
- gunichar2 *keyw = g_utf8_to_utf16(keyName.data(), -1, 0,0,0);
- gunichar2 *valuenamew = g_utf8_to_utf16(valueName.data(), -1, 0,0,0);
- gunichar2 *valuew = g_utf8_to_utf16(value.data(), -1, 0,0,0);
-
- HKEY key;
- if (RegCreateKeyExW(rootKey, (WCHAR*) keyw,
- 0, NULL, REG_OPTION_NON_VOLATILE,
- KEY_WRITE, NULL, &key, NULL))
- {
- fprintf(stderr, "RegistryTool: Could not create the registry key '%s'\n", keyName.c_str());
- goto fail;
- }
-
- // Set the value
- if (RegSetValueExW(key, (WCHAR*) valuenamew,
- 0, REG_SZ, (LPBYTE) valuew, (DWORD) (2*value.size() + 2)))
- {
- fprintf(stderr, "RegistryTool: Could not set the value '%s'\n", value.c_str());
- goto failkey;
- }
-
- ret = true;
-
- failkey:
- RegCloseKey(key);
-
- fail:
- g_free(keyw);
- g_free(valuenamew);
- return ret;
-}
-
-
-
-bool RegistryTool::getExeInfo(Glib::ustring &fullPath,
- Glib::ustring &path,
- Glib::ustring &exeName)
-{
- const int pathbuf = 2048;
- gunichar2 pathw[pathbuf];
- GetModuleFileNameW(NULL, (WCHAR*) pathw, pathbuf);
-
- gchar *utf8path = g_utf16_to_utf8(pathw, -1, 0,0,0);
- fullPath = utf8path;
- g_free(utf8path);
-
- path = "";
- exeName = "";
- Glib::ustring::size_type pos = fullPath.rfind('\\');
- if (pos != fullPath.npos)
- {
- path = fullPath.substr(0, pos);
- exeName = fullPath.substr(pos+1);
- }
-
- return true;
-}
-
-
-
-bool RegistryTool::setPathInfo()
-{
- Glib::ustring fullPath;
- Glib::ustring path;
- Glib::ustring exeName;
-
- if (!getExeInfo(fullPath, path, exeName))
- return false;
-
- //printf("full:'%s' path:'%s' exe:'%s'\n",
- // fullPath.c_str(), path.c_str(), exeName.c_str());
-
- Glib::ustring keyName =
- "HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\";
- keyName.append(exeName);
-
- Glib::ustring valueName = "";
- Glib::ustring value = fullPath;
-
- if (!setStringValue(keyName, valueName, value))
- return false;
-
- //add our subdirectories
- Glib::ustring appPath = path;
- appPath.append("\\python;");
- appPath.append(path);
- appPath.append("\\perl");
- valueName = "Path";
- value = appPath;
-
- if (!setStringValue(keyName, valueName, value))
- return false;
-
- return true;
-}
-
-
-#ifdef TESTREG
-
-
-/*
- * Compile this file with
- * g++ -DTESTREG registrytool.cpp -o registrytool
- * to run these tests.
- */
-
-
-
-void testReg()
-{
- RegistryTool rt;
- char *key =
- "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\inkscape.exe";
- char const *name = "";
- char const *value = "c:\\inkscape\\inkscape.exe";
- if (!rt.setStringValue(key, name, value))
- {
- printf("Test failed\n");
- }
- else
- {
- printf("Test succeeded\n");
- }
- name = "Path";
- value = "c:\\inkscape\\python";
- if (!rt.setStringValue(key, name, value))
- {
- printf("Test failed\n");
- }
- else
- {
- printf("Test succeeded\n");
- }
-}
-
-
-void testPath()
-{
- RegistryTool rt;
- rt.setPathInfo();
-}
-
-
-int main(int argc, char **argv)
-{
- //testReg();
- testPath();
- return 0;
-}
-
-#endif /* TESTREG */
-
-//########################################################################
-//# E N D O F F I L E
-//########################################################################
diff --git a/src/io/registrytool.h b/src/io/registrytool.h
deleted file mode 100644
index 3bb7d101a..000000000
--- a/src/io/registrytool.h
+++ /dev/null
@@ -1,61 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/** \file
- * Inkscape registry tool
- *//*
- * Authors:
- * see git history
- * Bob Jamison
- * Copyright (C) 2005-2018 Authors
- *
- * Released under GNU GPL v2+, read the file 'COPYING' for more information.
- */
-
-#ifndef SEEN_REGISTRYTOOL_H
-#define SEEN_REGISTRYTOOL_H
-
-namespace Glib {
- class ustring;
-}
-
-/**
- * Inkscape Registry Tool
- *
- * This simple tool is intended for allowing Inkscape to append subdirectories
- * to its path. This will allow extensions and other files to be accesses
- * without explicit user intervention.
- */
-class RegistryTool
-{
-public:
-
- RegistryTool()
- {}
-
- virtual ~RegistryTool()
- {}
-
- /**
- * Set the string value of a key/name registry entry.
- */
- bool setStringValue(const Glib::ustring &key,
- const Glib::ustring &valueName,
- const Glib::ustring &value);
-
- /**
- * Get the full path, directory, and base file name of this running executable.
- */
- bool getExeInfo(Glib::ustring &fullPath,
- Glib::ustring &path,
- Glib::ustring &exeName);
-
- /**
- * Append our subdirectories to the Application Path for this
- * application.
- */
- bool setPathInfo();
-
-
-};
-
-#endif // SEEN_REGISTRYTOOL_H
-