| 12345678910111213141516171819202122232425262728293031323334353637383940 |
- #include "MainWindow.hpp"
- #include <gtkmm/application.h>
- #include <gtk/gtk.h>
- #include <iostream>
- #include <cstdlib>
- #include <sys/stat.h>
- #include <string>
- int main(int argc, char *argv[]) {
- // --- THE HIJACK: Force Fontconfig to use a writable /tmp directory ---
- // This stops Pango from shitting the bed on headless/restrictive servers
- const char* user = std::getenv("USER");
- std::string safe_cache_dir = std::string("/tmp/gnome-vault-cache-") + (user ? user : "default");
-
- // Create the temporary directory (0777 gives it wide open permissions)
- mkdir(safe_cache_dir.c_str(), 0777);
-
- // Forcibly inject this into the environment before GTK boots
- setenv("XDG_CACHE_HOME", safe_cache_dir.c_str(), 1);
- // --- Standard GTK Initialization ---
- if (!gtk_init_check(&argc, &argv)) {
- std::cerr << "Bloody hell: GTK failed to initialize." << std::endl;
- std::cerr << "Your X11/Wayland display is either missing or rejecting the connection." << std::endl;
- std::cerr << "If you are on SSH, ensure you used 'ssh -X' and your local X server is running." << std::endl;
- return 1;
- }
- try {
- auto app = Gtk::Application::create(argc, argv, "org.gnome.vault");
- MainWindow window;
- return app->run(window);
- } catch (const Glib::Error& ex) {
- std::cerr << "GTK Error: " << ex.what() << std::endl;
- return 1;
- } catch (const std::exception& ex) {
- std::cerr << "Standard Exception: " << ex.what() << std::endl;
- return 1;
- }
- }
|