diff options
| author | lukeflo | 2025-02-27 17:45:40 +0100 |
|---|---|---|
| committer | lukeflo | 2025-02-27 17:45:40 +0100 |
| commit | c52dc7ed6951af2d74804d1275e577205960b235 (patch) | |
| tree | 3dc8acd0bd0e0a83922c2927cc5e00c35837ba5c /src | |
| parent | 5da77a2f812a0bb6e0057f7b2e2c642142fca125 (diff) | |
| download | bibiman-c52dc7ed6951af2d74804d1275e577205960b235.tar.gz bibiman-c52dc7ed6951af2d74804d1275e577205960b235.zip | |
add `file_prefix` option to config and opening function
Diffstat (limited to 'src')
| -rw-r--r-- | src/app.rs | 6 | ||||
| -rw-r--r-- | src/config.rs | 2 |
2 files changed, 7 insertions, 1 deletions
@@ -359,7 +359,11 @@ pub fn open_connected_file(cfg: &BibiConfig, file: &OsStr) -> Result<()> { // Build command to execute pdf-reader. 'xdg-open' is Linux standard let cmd = &cfg.general.pdf_opener; // If necessary, replace ~ with /home dir - let file = PathBuf::from(file); + let file = if cfg.general.file_prefix.is_some() { + cfg.general.file_prefix.clone().unwrap().join(file) + } else { + PathBuf::from(file) + }; let file = expand_home(&file); diff --git a/src/config.rs b/src/config.rs index 956b724..f1ac3ca 100644 --- a/src/config.rs +++ b/src/config.rs @@ -41,6 +41,7 @@ pub struct General { pub editor: Option<String>, pub pdf_opener: String, pub url_opener: String, + pub file_prefix: Option<PathBuf>, } /// Substruct [colors] in config.toml @@ -66,6 +67,7 @@ impl Default for BibiConfig { editor: None, pdf_opener: select_opener(), url_opener: select_opener(), + file_prefix: None, }, colors: Colors { main_text_color: Color::Indexed(250), |
