Skip to content

Commit ebac660

Browse files
authored
Merge pull request #2108 from TheDcoder/portable
Add explicit portable mode
2 parents 8ccb225 + 80ca739 commit ebac660

3 files changed

Lines changed: 15 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Added:
1010
- Keyboard shortcuts validation (e.g no duplicate key binds)
1111
- `actions.buffer.click_nickname` and `actions.nicklist.click_nickname` can be used to specify whether a nickname will: open query and how the query is opened, insert nickname in the input box, or no action (`"no-action"` or `"noop"`); takes over functionality from `buffer.nickname.click` and `buffer.channel.nicklist.click` and adds the ability to perform no action
1212
- `actions.buffer.click_channel_name` and `actions.buffer.click_highlight` can be set to no action (`"no-action"` or `"noop"`) to not open the channel when clicking on the channel name
13+
- Explicit portable mode
1314

1415
Fixed:
1516

@@ -36,7 +37,7 @@ Changed:
3637

3738
Thanks:
3839

39-
- Contributions: @englut, @luca020400, @classabbyamp, @KaiKorla
40+
- Contributions: @englut, @luca020400, @classabbyamp, @KaiKorla, @TheDcoder
4041
- Bug reports: @luca020400, agent314
4142

4243
# 2026.7.2 (2026-06-08)

data/src/environment.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,19 @@ pub fn cache_dir() -> PathBuf {
3838
.join("halloy")
3939
}
4040

41-
/// Checks if a config file exists in the same directory as the executable.
41+
/// Checks if a portable dir is explicitly set or if a config file
42+
/// exists in the same directory as the executable.
4243
/// If so, it'll use that directory for both config & data dirs.
4344
fn portable_dir() -> Option<PathBuf> {
45+
if let Some(path) = env::var_os("HALLOY_PORTABLE_DIR") {
46+
let path = PathBuf::from(path);
47+
if path.is_dir() {
48+
return Some(path);
49+
} else {
50+
panic!("Given portable directory isn't valid!");
51+
}
52+
}
53+
4454
let exe = env::current_exe().ok()?;
4555
let dir = exe.parent()?;
4656

docs/guides/portable-mode.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ To enable portable mode for Halloy, simply place the `config.toml` file in the s
77
├── Halloy.app
88
└── config.toml
99
```
10+
11+
Or you can set the `HALLOY_PORTABLE_DIR` environment variable to a valid directory path explicitly.

0 commit comments

Comments
 (0)