Skip to content

Commit

Permalink
Revert "config.rs should be ignored, load PKGDATADIR from config"
Browse files Browse the repository at this point in the history
This reverts commit 98c6f77.
  • Loading branch information
adzialocha committed Dec 11, 2024
1 parent 98c6f77 commit 280e698
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
.flatpak-builder
src/config.rs
target
.flatpak-builder
3 changes: 3 additions & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pub static VERSION: &str = "0.1.0";
pub static GETTEXT_PACKAGE: &str = "aardvark";
pub static LOCALEDIR: &str = "/app/share/locale";
11 changes: 6 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,13 @@ 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 @@ -64,17 +65,17 @@ fn main() -> glib::ExitCode {
fn get_pkgdatadir() -> PathBuf {
#[cfg(target_os = "macos")]
{
let exe_path = std::env::current_exe().expect("Failed to get current executable path");
let exe_path = 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(PKGDATADIR)
PathBuf::from("/app/share/aardvark")
}
}

0 comments on commit 280e698

Please sign in to comment.