diff --git a/configure.ac b/configure.ac index 8b8ec9c70c2353b9c1a4beb771955fa887d007ea..ea3b84a355374f4f51d40dd451bc7234de8fe058 100644 --- a/configure.ac +++ b/configure.ac @@ -19,8 +19,9 @@ AM_SILENT_RULES([yes]) ########################## AEGISUB_PATH_SOURCE="$(dirname $(readlink -f "$0"))" AEGISUB_PATH_BUILD="$(pwd)" -AS_IF([! test "$AEGISUB_PATH_BUILD" = "$AEGISUB_PATH_BUILD"], +AS_IF([! test "$AEGISUB_PATH_SOURCE" = "$AEGISUB_PATH_BUILD"], [AC_MSG_ERROR([The build directory must be the same as the source directory])]) +AC_DEFINE_UNQUOTED([AEGISUB_PATH_SOURCE], ["$AEGISUB_PATH_SOURCE"], [Path to the root sources folder]) ################### # Required packages diff --git a/libaegisub/common/log.cpp b/libaegisub/common/log.cpp index ce7ceb1df8669029975fe14edf3a3b9c006c3ef6..bac51fb7e1d917e3834849ae3d26b21cf5616c72 100644 --- a/libaegisub/common/log.cpp +++ b/libaegisub/common/log.cpp @@ -91,6 +91,11 @@ decltype(LogSink::messages) LogSink::GetMessages() const Message::Message(const char *section, Severity severity, const char *file, const char *func, int line) : msg(buffer, sizeof buffer) { + /* Crop the __FILE__ to be relative to the source folder. Doing it to have + * more place on the screen and don't leak build folder paths. */ + for (int i = 0; file && file[0] == AEGISUB_PATH_SOURCE[i]; ++i) ++file; + if (file[0] && file[0] == '/') ++file; + using namespace std::chrono; sm.section = section; sm.severity = severity; diff --git a/libaegisub/lua/modules/lfs.cpp b/libaegisub/lua/modules/lfs.cpp index 8053b6893a76fc28af0a6a77d308c5a86af398c8..38f29d7928852a64ba247379c0ff366c067b6220 100644 --- a/libaegisub/lua/modules/lfs.cpp +++ b/libaegisub/lua/modules/lfs.cpp @@ -112,7 +112,7 @@ DirectoryIterator *dir_new(const char *path, char **err) const char *get_mode(const char *path, char **err) { - return wrap(err, [ = ]() -> const char* { + return wrap(err, [ = ]() -> const char * { switch (bfs::status(path).type()) { case bfs::file_not_found: return nullptr; break; diff --git a/libaegisub/unix/path.cpp b/libaegisub/unix/path.cpp index 138d33273dc222f40669d307061f6efda708b109..0da8434011d6cbbf9a269fe45114bab8b6ad6128 100644 --- a/libaegisub/unix/path.cpp +++ b/libaegisub/unix/path.cpp @@ -50,16 +50,6 @@ void Path::FillPlatformSpecificPaths() agi::fs::path home = home_dir(); SetToken("?user", home / ".aegisub"); SetToken("?local", home / ".aegisub"); - SetToken("?data", P_DATA); - SetToken("?dictionary", "/usr/share/hunspell"); -#else /* Now __APPLE__ is defined */ - agi::fs::path app_support = agi::util::GetApplicationSupportDirectory(); - SetToken("?user", app_support / "Aegisub"); - SetToken("?local", app_support / "Aegisub"); - SetToken("?data", agi::util::GetBundleSharedSupportDirectory()); - SetToken("?dictionary", agi::util::GetBundleSharedSupportDirectory() + "/dictionaries"); -#endif /* __APPLE__ */ - SetToken("?temp", boost::filesystem::temp_directory_path()); #ifdef AEGISUB_LINUX char *P_EXEC = getenv("P_EXEC"); if (P_EXEC && P_EXEC[0] != '\0' && std::string(P_EXEC).rfind("/tmp/.mount_") == 0) { @@ -70,7 +60,21 @@ void Path::FillPlatformSpecificPaths() std::string p_data = (p_exec.parent_path().parent_path() / "share/aegisub").string(); SetToken("?data", p_data); } + else { + SetToken("?data", P_DATA); + } +#else + SetToken("?data", P_DATA); #endif /* AEGISUB_LINUX */ + SetToken("?dictionary", "/usr/share/hunspell"); +#else /* Now __APPLE__ is defined */ + agi::fs::path app_support = agi::util::GetApplicationSupportDirectory(); + SetToken("?user", app_support / "Aegisub"); + SetToken("?local", app_support / "Aegisub"); + SetToken("?data", agi::util::GetBundleSharedSupportDirectory()); + SetToken("?dictionary", agi::util::GetBundleSharedSupportDirectory() + "/dictionaries"); +#endif /* __APPLE__ */ + SetToken("?temp", boost::filesystem::temp_directory_path()); } } diff --git a/src/mkv_wrap.cpp b/src/mkv_wrap.cpp index bc9aa58d97a978112a6e5279b3822a6574cb01a3..acb4be0e7c9732b0be224ea1f3ad2bdc0c26c282 100644 --- a/src/mkv_wrap.cpp +++ b/src/mkv_wrap.cpp @@ -105,7 +105,7 @@ struct MkvStdIO final : InputStream { read = &MkvStdIO::Read; scan = &MkvStdIO::Scan; getcachesize = [](InputStream *) -> unsigned int { return 16 * 1024 * 1024; }; - geterror = [](InputStream * st) -> const char* { return ((MkvStdIO *)st)->error.c_str(); }; + geterror = [](InputStream * st) -> const char * { return ((MkvStdIO *)st)->error.c_str(); }; memalloc = [](InputStream *, size_t size) { return malloc(size); }; memrealloc = [](InputStream *, void *mem, size_t size) { return realloc(mem, size); }; memfree = [](InputStream *, void *mem) { free(mem); };