Skip to content

Commit

Permalink
config.rs should be ignored, load PKGDATADIR from config
Browse files Browse the repository at this point in the history
  • Loading branch information
adzialocha committed Dec 11, 2024
1 parent dcc34ac commit 98c6f77
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.flatpak-builder
src/config.rs
target
.flatpak-builder
3 changes: 0 additions & 3 deletions src/config.rs

This file was deleted.

11 changes: 5 additions & 6 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,12 @@ mod textbuffer;
mod window;

use std::path::PathBuf;
use std::env;

use self::application::AardvarkApplication;
use self::config::{GETTEXT_PACKAGE, LOCALEDIR, PKGDATADIR};
use self::textbuffer::AardvarkTextBuffer;
use self::window::AardvarkWindow;


use config::{GETTEXT_PACKAGE, LOCALEDIR};
use gettextrs::{bind_textdomain_codeset, bindtextdomain, textdomain};
use gtk::prelude::*;
use gtk::{gio, glib};
Expand Down Expand Up @@ -65,17 +64,17 @@ fn main() -> glib::ExitCode {
fn get_pkgdatadir() -> PathBuf {
#[cfg(target_os = "macos")]
{
let exe_path = env::current_exe().expect("Failed to get current executable path");
let exe_path = std::env::current_exe().expect("Failed to get current executable path");
// Navigate to the 'Resources/share/aardvark' directory relative to the executable
exe_path
.parent() // Goes up to 'Contents/MacOS'
.parent() // Goes up to 'Contents/MacOS'
.and_then(|p| p.parent()) // Goes up to 'Contents'
.map(|p| p.join("Resources/share/aardvark"))
.expect("Failed to compute PKGDATADIR")
}

#[cfg(not(target_os = "macos"))]
{
PathBuf::from("/app/share/aardvark")
PathBuf::from(PKGDATADIR)
}
}

0 comments on commit 98c6f77

Please sign in to comment.