Skip to content

Commit d875eb3

Browse files
committed
convert paths to string
fixes error: cannot convert ‘std::filesystem::__cxx11::path’ to ‘const agi::fs::path&’
1 parent 3993398 commit d875eb3

File tree

4 files changed

+18
-22
lines changed

4 files changed

+18
-22
lines changed

libaegisub/osx/path.mm

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,15 @@
1717
#include <libaegisub/path.h>
1818
#include <libaegisub/util_osx.h>
1919

20+
namespace sfs = std::filesystem;
21+
2022
namespace agi {
2123
void Path::FillPlatformSpecificPaths() {
22-
std::filesystem::path app_support = agi::util::GetApplicationSupportDirectory();
23-
SetToken("?user", app_support/"Aegisub");
24-
SetToken("?local", app_support/"Aegisub");
24+
agi::fs::path user_dir = agi::fs::path(sfs::path(agi::util::GetApplicationSupportDirectory()))/"Aegisub";
25+
SetToken("?user", user_dir);
26+
SetToken("?local", user_dir);
2527
SetToken("?data", agi::util::GetBundleSharedSupportDirectory());
2628
SetToken("?dictionary", Decode("?data/dictionaries"));
27-
SetToken("?temp", std::filesystem::temp_directory_path());
29+
SetToken("?temp", agi::fs::path(sfs::temp_directory_path()));
2830
}
2931
}

libaegisub/unix/path.cpp

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,20 @@
2323
namespace sfs = std::filesystem;
2424

2525
namespace {
26-
std::string home_dir() {
26+
agi::fs::path home_dir() {
2727
const char *env = getenv("HOME");
28-
if (env) return env;
28+
if (env) return agi::fs::path(sfs::path(env));
2929

3030
if ((env = getenv("USER")) || (env = getenv("LOGNAME"))) {
3131
if (passwd *user_info = getpwnam(env))
32-
return user_info->pw_dir;
32+
return agi::fs::path(sfs::path(user_info->pw_dir));
3333
}
3434

3535
throw agi::EnvironmentError("Could not get home directory. Make sure HOME is set.");
3636
}
3737

3838
#ifdef APPIMAGE_BUILD
39-
sfs::path data_dir() {
39+
agi::fs::path data_dir() {
4040
char *exe = realpath("/proc/self/exe", NULL);
4141
if (!exe) return "";
4242

@@ -45,30 +45,29 @@ sfs::path data_dir() {
4545

4646
if (p.filename() == "bin") {
4747
// assume unix prefix layout
48-
return p.parent_path()/"share";
48+
return agi::fs::path(p.parent_path()/"share");
4949
}
5050

51-
return p;
51+
return agi::fs::path(p);
5252
}
5353
#endif
5454
}
5555

5656
namespace agi {
5757
void Path::FillPlatformSpecificPaths() {
58-
sfs::path home = home_dir();
59-
SetToken("?user", home/".aegisub");
60-
SetToken("?local", home/".aegisub");
58+
agi::fs::path dotdir = home_dir()/".aegisub";
59+
SetToken("?user", dotdir);
60+
SetToken("?local", dotdir);
6161

6262
#ifdef APPIMAGE_BUILD
63-
sfs::path data = data_dir();
64-
if (data == "") data = home/".aegisub";
65-
SetToken("?data", data);
63+
agi::fs::path data = data_dir();
64+
SetToken("?data", (data == "") ? dotdir : data);
6665
SetToken("?dictionary", Decode("?data/dictionaries"));
6766
#else
6867
SetToken("?data", P_DATA);
6968
SetToken("?dictionary", "/usr/share/hunspell");
7069
#endif
7170

72-
SetToken("?temp", sfs::temp_directory_path());
71+
SetToken("?temp", agi::fs::path(sfs::temp_directory_path()));
7372
}
7473
}

meson.build

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,6 @@ if get_option('enable_update_checker')
7575
conf.set_quoted('UPDATE_CHECKER_SERVER', get_option('update_server'))
7676
conf.set_quoted('UPDATE_CHECKER_BASE_URL', get_option('update_url'))
7777
endif
78-
if get_option('relocatable') and host_machine.system() == 'linux'
79-
conf.set('APPIMAGE_BUILD', 1)
80-
endif
8178

8279
deps = []
8380
deps_inc = []

meson_options.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,3 @@ option('update_server', type: 'string', value: 'https://aegisub-updates.redvice.
2626
option('update_url', type: 'string', value: '/trunk', description: 'Base path to use for the update checker')
2727

2828
option('build_osx_bundle', type: 'boolean', value: false, description: 'Package Aegisub.app on OSX')
29-
30-
option('relocatable', type: 'boolean', value: false, description: 'Enable relocatable build')

0 commit comments

Comments
 (0)