Comments (1)
I have a patch that works on arch1's fork, if you're interested:
From ee22306713bfa5ecdac072dbab6f648421b295d0 Mon Sep 17 00:00:00 2001
From: witchymary
Date: Sun, 8 Oct 2023 14:39:05 -0300
Subject: [PATCH] XDG Support
---
libaegisub/unix/path.cpp | 21 +++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)
diff --git a/libaegisub/unix/path.cpp b/libaegisub/unix/path.cpp
index 7a2c9a465..e40961a01 100644
--- a/libaegisub/unix/path.cpp
+++ b/libaegisub/unix/path.cpp
@@ -42,6 +42,14 @@ std::string home_dir() {
throw agi::EnvironmentError("Could not get home directory. Make sure HOME is set.");
}
+std::string xdg_dir(const std::string &environment_variable,
+ const std::string &fallback_directory)
+{
+ const char *env = getenv(environment_variable.c_str());
+ if (env && *env) return env;
+ return fallback_directory;
+}
+
#ifdef APPIMAGE_BUILD
std::string exe_dir() {
char *exe, *dir;
@@ -71,8 +79,17 @@ namespace agi {
void Path::FillPlatformSpecificPaths() {
#ifndef __APPLE__
agi::fs::path home = home_dir();
- SetToken("?user", home/".aegisub");
- SetToken("?local", home/".aegisub");
+ agi::fs::path prev_dir = home/".aegisub";
+ if (!boost::filesystem::exists(prev_dir))
+ {
+ agi::fs::path xdg_config_home = xdg_dir("XDG_CONFIG_HOME", (home/".config").string());
+ agi::fs::path xdg_cache_home = xdg_dir("XDG_CACHE_HOME", (home/".cache").string());
+ SetToken("?user", xdg_config_home/"Aegisub");
+ SetToken("?local", xdg_cache_home/"Aegisub");
+ } else {
+ SetToken("?user", prev_dir);
+ SetToken("?local", prev_dir);
+ }
#ifdef APPIMAGE_BUILD
agi::fs::path exe = exe_dir();
--
2.42.0
from aegisub.
Related Issues (20)
- "Use Dummy Video" cannot be displayed normally HOT 4
- Width of style editor window can't be resizable in Linux HOT 2
- Speed up play HOT 3
- [FontCollector] Add a warning message if a font has variable axes
- [Feature Request] Limit Font Choices to User-Installed Fonts, or Any Arbitrary Subset HOT 1
- xxhash-0.dll was not found HOT 3
- failed to compile ffmpeg wrap on linux container
- [Bug] Multiple windows and scroll issues on macOS
- [Feature Request] Furigana support for Kanji Timer
- [Feature Request] New multi-highlight syntax for furigana folowed by hiragana/punctuation highlight in Karaoke Templater HOT 7
- Feature request: audio speedup
- Switch to C++20 / Rebase on top of TypesettingTools/Aegisub HOT 2
- aegisub.appdata.xml cannot pass validation HOT 1
- Feature Request: Color Management
- Crash in agi::Thesaurus::Thesaurus with Boost 1.85.0 and GCC >= 13 HOT 1
- [Request] Add avisynth+lsmash support to Ubuntu.AppImage HOT 2
- [Issue] File in use + Saving = Aegisub Crashing
- question: what is the difference between wx master and the one that doesn't say that? HOT 2
- [Feature Request] Add 'Number of characters in longest subtitle line' as a Subtitles Grid column
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aegisub.