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

[misc] Correct some paths for AppImages

parent cbd48a5f
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -52,6 +52,11 @@ AS_CASE([$host],
AC_SUBST(build_darwin)
AC_SUBST(build_linux)
if test "x$build_linux" = "xyes"
then
AC_DEFINE_UNQUOTED([AEGISUB_LINUX], 1, [Build Aegisub for Linux])
fi
########################
# Configurable variables
########################
......@@ -88,7 +93,7 @@ AS_CASE([x$prefix], [xNONE | x], [prefix="$ac_default_prefix"], [])
# Build with appimage support
# Do this here because we will override the install path
AC_ARG_ENABLE([appimage],
[AS_HELP_STRING([--enable-appimage], [Build Aegisub as an AppImage. Defaults to no])],
[AS_HELP_STRING([--enable-appimage], [Build Aegisub as an AppImage. [no]])],
[AEGISUB_APPIMAGE_ENABLED=$enableval],
[AEGISUB_APPIMAGE_ENABLED=no])
AS_IF([test "x$AEGISUB_APPIMAGE_ENABLED" = "xyes"], [
......@@ -148,7 +153,6 @@ AS_IF([test x$use_build_credit = xyes],
####################
# Check for programs
####################
CHECK_GNU_MAKE
AC_PROG_CC
AC_PROG_CXX
AC_LANG(C++)
......@@ -565,9 +569,23 @@ AC_PCH_FLAG([-fpch-preprocess])
##############################
AM_GNU_GETTEXT([external])
################
############################################################################
# Update checker
################
# * The $HOSTNAME/$URL should contains a file such as:
# 3.3.3
# Changelog v3.3.3
#
# * Added link to Joysound Exporter in the 'Help' menu
# * Fixed UTF-8 being read as ASCII leading to missing characters on Linux
# and crashes on Windows
# * Use system and user fonts on Windows
#
# Changelog v3.3.2-2
# Added the Amaranth font installation to the Windows installer.
# * The content of the folder must be something like this:
# - latest
# - Aegisub-latest-x64
############################################################################
AC_MSG_CHECKING([whether to enable the update checker])
AC_ARG_ENABLE(update-checker,
AS_HELP_STRING([--disable-update-checker], [disable the update checker [no]]))
......@@ -581,15 +599,15 @@ AC_ARG_WITH(update-server,
AS_HELP_STRING([--with-update-server=HOSTNAME],
[Server to use for the update checker
[mugen.karaokes.moe]]))
AC_MSG_RESULT(${with_update_server:=mugen.karaokes.moe})
AC_MSG_RESULT(${with_update_server:=kurisu.iiens.net})
AC_DEFINE_UNQUOTED([UPDATE_CHECKER_SERVER], ["$with_update_server"],
[Server for the update checker])
AC_MSG_CHECKING([for update checker base URL])
AC_ARG_WITH(update-url,
AS_HELP_STRING([--with-update-url=HOSTNAME],
[Base path to use for the update checker [/downloads/aegisub-japan7]]))
AC_MSG_RESULT(${with_update_url:=/downloads/aegisub-japan7})
[Base path to use for the update checker [/dist/aegisub]]))
AC_MSG_RESULT(${with_update_url:=/dist/aegisub})
AC_DEFINE_UNQUOTED([UPDATE_CHECKER_BASE_URL], ["$with_update_url"],
[Base path for the update checker])
......
......@@ -14,6 +14,8 @@
//
// Aegisub Project http://www.aegisub.org/
#include "libaegisub/log.h"
#include <libaegisub/path.h>
#include <libaegisub/exception.h>
......@@ -39,6 +41,8 @@ std::string home_dir()
#endif
}
#include <iostream>
namespace agi {
void Path::FillPlatformSpecificPaths()
{
......@@ -48,14 +52,25 @@ void Path::FillPlatformSpecificPaths()
SetToken("?local", home / ".aegisub");
SetToken("?data", P_DATA);
SetToken("?dictionary", "/usr/share/hunspell");
#else
#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
#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) {
/* Craft the P_DATA with the P_EXEC because we are in an AppImage The
* string should be /tmp/.mount_(.*)/usr/bin/aegisub and need to be
* transformed to /tmp/.mount_(.*)/usr/share/aegisub/ */
agi::fs::path p_exec(P_EXEC);
std::string p_data = (p_exec.parent_path().parent_path() / "share/aegisub").string();
SetToken("?data", p_data);
}
#endif /* AEGISUB_LINUX */
}
}
......@@ -38,6 +38,7 @@
#include "string_codec.h"
#include "subs_controller.h"
#include <libaegisub/log.h>
#include <libaegisub/dispatch.h>
#include <libaegisub/format.h>
#include <libaegisub/fs.h>
......@@ -327,6 +328,7 @@ void AutoloadScriptManager::Reload()
for (auto tok : agi::Split(path, '|')) {
auto dirname = config::path->Decode(agi::str(tok));
LOG_D("agi/script/reload") << "Using folder " << dirname << " to reload scripts";
if (!agi::fs::DirectoryExists(dirname)) continue;
for (auto filename : agi::fs::DirectoryIterator(dirname, "*.*"))
......
......@@ -72,6 +72,7 @@
#include <wx/msgdlg.h>
#include <wx/stackwalk.h>
#include <wx/utils.h>
#include <wx/stdpaths.h>
namespace config {
agi::Options *opt = nullptr;
......@@ -166,6 +167,16 @@ bool AegisubApp::OnInit()
}
});
#ifdef AEGISUB_LINUX
{
// Set the P_EXEC if we are on Linux. This variable will be needed if
// we are inside an AppImage when creating the config::path.
wxString appPath(wxStandardPaths::Get().GetExecutablePath());
const char *appPathCStr = appPath.ToUTF8().data();
setenv("P_EXEC", appPathCStr, 1);
}
#endif
config::path = new agi::Path;
crash_writer::Initialize(config::path->Decode("?user"));
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter