Minor changes

master
Melroy van den Berg 2022-02-10 22:57:24 +01:00
parent 4e9cc7ba97
commit a144cc2030
No known key found for this signature in database
GPG Key ID: 71D11FF23454B9D7
4 changed files with 18 additions and 11 deletions

View File

@ -1,7 +1,6 @@
include(${CMAKE_SOURCE_DIR}/cmake/GSettings.cmake)
set(PROJECT_TARGET libreweb-browser)
set(PROJECT_TARGET_LIB ${PROJECT_TARGET}-lib)
set(THREADS_PREFER_PTHREAD_FLAG ON)
# Find required dependencies
@ -54,15 +53,15 @@ add_schema("org.libreweb.browser.gschema.xml" GSCHEMA_RING)
# For Windows & macOS
if(WIN32 OR APPLE)
# Windows Schema files
set(WINDOWS_SCHEMA_FILES
# Additional schema files
set(ADDITIONAL_SCHEMA_FILES
org.gtk.Settings.ColorChooser.gschema.xml
org.gtk.Settings.Debug.gschema.xml
org.gtk.Settings.EmojiChooser.gschema.xml
org.gtk.Settings.FileChooser.gschema.xml
)
message(STATUS "Add Windows Schema files")
foreach(SCHEMA_FILE ${WINDOWS_SCHEMA_FILES})
foreach(SCHEMA_FILE ${ADDITIONAL_SCHEMA_FILES})
add_schema(${SCHEMA_FILE} GSCHEMA_RING)
endforeach(SCHEMA_FILE)
endif()
@ -135,6 +134,7 @@ if(NOT UNITTEST)
# Install browser binary
install(TARGETS ${PROJECT_TARGET} RUNTIME DESTINATION bin)
else()
set(PROJECT_TARGET_LIB ${PROJECT_TARGET}-lib)
# Build libraries for unit testing
add_library(${PROJECT_TARGET_LIB}-file STATIC file.h file.cc)
add_library(${PROJECT_TARGET_LIB}-draw STATIC draw.h draw.cc md-parser.h md-parser.cc)

View File

@ -130,7 +130,8 @@ std::string IPFSDaemon::locateIPFSBinary()
#elif defined(__APPLE__)
ipfsBinaryName += "-darwin";
#endif
// Use the current executable directory (bin folder), to locate the go-ipfs binary (for both Linux and Windows)
// Use the current executable directory (bin folder), to locate the go-ipfs binary
// (for Linux, Mac OS and Windows)
char* path = NULL;
int length, dirnameLength;
length = wai_getExecutablePath(NULL, 0, &dirnameLength);
@ -151,8 +152,8 @@ std::string IPFSDaemon::locateIPFSBinary()
}
std::string ipfs_binary_path = Glib::build_filename(currentExecutablePath, ipfsBinaryName);
// When working directory is the build/bin folder (relative path), during the build (when package is not installed
// yet)
// When working directory is the build/bin folder (relative path), during the build
// (when package is not installed yet)
std::string ipfs_binary_path_dev = Glib::build_filename(n_fs::current_path().string(), "..", "..", "go-ipfs", ipfsBinaryName);
if (Glib::file_test(ipfs_binary_path, Glib::FileTest::FILE_TEST_IS_EXECUTABLE))
{

View File

@ -17,6 +17,7 @@
#include <gtkmm/settings.h>
#include <iostream>
#include <nlohmann/json.hpp>
#include <string.h>
#include <whereami.h>
MainWindow::MainWindow(const std::string& timeout)
@ -1866,12 +1867,16 @@ bool MainWindow::isInstalled()
bool isInstalled = true;
wai_getExecutablePath(path, length, NULL);
path[length] = '\0';
#ifdef _WIN32
// Does the executable path starts with C:\Program?
#if defined(_WIN32)
// Does the executable path starts with "C:\Program"?
const char* windowsPrefix = "C:\\Program";
isInstalled = (strncmp(path, windowsPrefix, strlen(windowsPrefix)) == 0);
#else
// Does the executable path starts with /usr/local?
#elif defined(_APPLE_)
// Does the executable path contains "Applications"?
const char* macOsNeedle = "Applications";
isInstalled = (strstr(path, macOsNeedle) != NULL);
#elif defined(__linux__)
// Does the executable path starts with "/usr/local"?
isInstalled = (strncmp(path, INSTALL_PREFIX, strlen(INSTALL_PREFIX)) == 0);
#endif
free(path);

View File

@ -41,6 +41,7 @@
#include <gtkmm/treeview.h>
#include <gtkmm/window.h>
#include <sigc++/connection.h>
#include <string>
struct cmark_node;