Skip to content
Extraits de code Groupes Projets
Vérifiée Valider a2011a08 rédigé par Kubat's avatar Kubat
Parcourir les fichiers

[log & misc] Correct sett of data folder and shorten filenames for log macros

parent a711aaef
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -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
......
......@@ -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;
......
......@@ -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;
......
......@@ -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());
}
}
......@@ -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); };
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter