Kill StandardPaths

It's now just a pointless wrapper around agi::Path.
This commit is contained in:
Thomas Goyne 2013-01-29 19:35:37 -08:00
parent af37047736
commit 396ff897e5
26 changed files with 93 additions and 163 deletions

View file

@ -213,7 +213,6 @@
<ClInclude Include="$(SrcDir)spellchecker_hunspell.h" /> <ClInclude Include="$(SrcDir)spellchecker_hunspell.h" />
<ClInclude Include="$(SrcDir)spline.h" /> <ClInclude Include="$(SrcDir)spline.h" />
<ClInclude Include="$(SrcDir)spline_curve.h" /> <ClInclude Include="$(SrcDir)spline_curve.h" />
<ClInclude Include="$(SrcDir)standard_paths.h" />
<ClInclude Include="$(SrcDir)string_codec.h" /> <ClInclude Include="$(SrcDir)string_codec.h" />
<ClInclude Include="$(SrcDir)subs_edit_box.h" /> <ClInclude Include="$(SrcDir)subs_edit_box.h" />
<ClInclude Include="$(SrcDir)subs_edit_ctrl.h" /> <ClInclude Include="$(SrcDir)subs_edit_ctrl.h" />
@ -403,7 +402,6 @@
<ClCompile Include="$(SrcDir)spellchecker_hunspell.cpp" /> <ClCompile Include="$(SrcDir)spellchecker_hunspell.cpp" />
<ClCompile Include="$(SrcDir)spline.cpp" /> <ClCompile Include="$(SrcDir)spline.cpp" />
<ClCompile Include="$(SrcDir)spline_curve.cpp" /> <ClCompile Include="$(SrcDir)spline_curve.cpp" />
<ClCompile Include="$(SrcDir)standard_paths.cpp" />
<ClCompile Include="$(SrcDir)string_codec.cpp" /> <ClCompile Include="$(SrcDir)string_codec.cpp" />
<ClCompile Include="$(SrcDir)subs_edit_box.cpp" /> <ClCompile Include="$(SrcDir)subs_edit_box.cpp" />
<ClCompile Include="$(SrcDir)subs_edit_ctrl.cpp" /> <ClCompile Include="$(SrcDir)subs_edit_ctrl.cpp" />

View file

@ -582,9 +582,6 @@
<ClInclude Include="$(SrcDir)spline.h"> <ClInclude Include="$(SrcDir)spline.h">
<Filter>Video\Visual tools</Filter> <Filter>Video\Visual tools</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="$(SrcDir)standard_paths.h">
<Filter>Utilities</Filter>
</ClInclude>
<ClInclude Include="$(SrcDir)version.h"> <ClInclude Include="$(SrcDir)version.h">
<Filter>Features\About box</Filter> <Filter>Features\About box</Filter>
</ClInclude> </ClInclude>
@ -1112,9 +1109,6 @@
<ClCompile Include="$(SrcDir)spline_curve.cpp"> <ClCompile Include="$(SrcDir)spline_curve.cpp">
<Filter>Video\Visual tools</Filter> <Filter>Video\Visual tools</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="$(SrcDir)standard_paths.cpp">
<Filter>Utilities</Filter>
</ClCompile>
<ClCompile Include="$(SrcDir)command\subtitle.cpp"> <ClCompile Include="$(SrcDir)command\subtitle.cpp">
<Filter>Commands</Filter> <Filter>Commands</Filter>
</ClCompile> </ClCompile>

View file

@ -219,7 +219,6 @@ SRC += \
spellchecker.cpp \ spellchecker.cpp \
spline.cpp \ spline.cpp \
spline_curve.cpp \ spline_curve.cpp \
standard_paths.cpp \
string_codec.cpp \ string_codec.cpp \
subs_controller.cpp \ subs_controller.cpp \
subs_edit_box.cpp \ subs_edit_box.cpp \

View file

@ -36,10 +36,12 @@
#include "aegisublocale.h" #include "aegisublocale.h"
#include "standard_paths.h" #include "options.h"
#include <libaegisub/path.h>
#include <algorithm> #include <algorithm>
#include <boost/filesystem/path.hpp> #include <boost/locale.hpp>
#include <clocale> #include <clocale>
#include <functional> #include <functional>
@ -54,7 +56,7 @@ wxTranslations *AegisubLocale::GetTranslations() {
wxTranslations *translations = wxTranslations::Get(); wxTranslations *translations = wxTranslations::Get();
if (!translations) { if (!translations) {
wxTranslations::Set(translations = new wxTranslations); wxTranslations::Set(translations = new wxTranslations);
wxFileTranslationsLoader::AddCatalogLookupPathPrefix(StandardPaths::DecodePath("?data/locale/").wstring()); wxFileTranslationsLoader::AddCatalogLookupPathPrefix(config::path->Decode("?data/locale/").wstring());
} }
return translations; return translations;
} }

View file

@ -37,12 +37,13 @@
#include "ass_style_storage.h" #include "ass_style_storage.h"
#include "ass_style.h" #include "ass_style.h"
#include "standard_paths.h" #include "options.h"
#include "text_file_reader.h" #include "text_file_reader.h"
#include "text_file_writer.h" #include "text_file_writer.h"
#include "utils.h" #include "utils.h"
#include <libaegisub/fs.h> #include <libaegisub/fs.h>
#include <libaegisub/path.h>
#include <boost/algorithm/string/predicate.hpp> #include <boost/algorithm/string/predicate.hpp>
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
@ -54,9 +55,9 @@ AssStyleStorage::~AssStyleStorage() {
void AssStyleStorage::Save() const { void AssStyleStorage::Save() const {
if (storage_name.empty()) return; if (storage_name.empty()) return;
agi::fs::CreateDirectory(StandardPaths::DecodePath("?user/catalog/")); agi::fs::CreateDirectory(config::path->Decode("?user/catalog/"));
TextFileWriter file(StandardPaths::DecodePath("?user/catalog/" + storage_name + ".sty"), "UTF-8"); TextFileWriter file(config::path->Decode("?user/catalog/" + storage_name + ".sty"), "UTF-8");
for (const AssStyle *cur : style) for (const AssStyle *cur : style)
file.WriteLineToFile(cur->GetEntryData()); file.WriteLineToFile(cur->GetEntryData());
} }
@ -66,7 +67,7 @@ void AssStyleStorage::Load(std::string const& name) {
Clear(); Clear();
try { try {
TextFileReader file(StandardPaths::DecodePath("?user/catalog/" + name + ".sty"), "UTF-8"); TextFileReader file(config::path->Decode("?user/catalog/" + name + ".sty"), "UTF-8");
while (file.HasMoreLines()) { while (file.HasMoreLines()) {
try { try {

View file

@ -39,12 +39,12 @@
#include "audio_controller.h" #include "audio_controller.h"
#include "options.h" #include "options.h"
#include "standard_paths.h"
#include "utils.h" #include "utils.h"
#include <libaegisub/access.h> #include <libaegisub/access.h>
#include <libaegisub/charset_conv.h> #include <libaegisub/charset_conv.h>
#include <libaegisub/fs.h> #include <libaegisub/fs.h>
#include <libaegisub/path.h>
#include <mutex> #include <mutex>
@ -67,7 +67,7 @@ AvisynthAudioProvider::AvisynthAudioProvider(agi::fs::path const& filename) {
AVSValue args[3] = { env->SaveString(agi::fs::ShortName(filename).c_str()), false, true }; AVSValue args[3] = { env->SaveString(agi::fs::ShortName(filename).c_str()), false, true };
// Load DirectShowSource.dll from app dir if it exists // Load DirectShowSource.dll from app dir if it exists
agi::fs::path dsspath(StandardPaths::DecodePath("?data/DirectShowSource.dll")); agi::fs::path dsspath(config::path->Decode("?data/DirectShowSource.dll"));
if (agi::fs::FileExists(dsspath)) if (agi::fs::FileExists(dsspath))
env->Invoke("LoadPlugin", env->SaveString(agi::fs::ShortName(dsspath).c_str())); env->Invoke("LoadPlugin", env->SaveString(agi::fs::ShortName(dsspath).c_str()));

View file

@ -42,7 +42,6 @@
#include "dialog_progress.h" #include "dialog_progress.h"
#include "include/aegisub/context.h" #include "include/aegisub/context.h"
#include "options.h" #include "options.h"
#include "standard_paths.h"
#include "string_codec.h" #include "string_codec.h"
#include "subs_controller.h" #include "subs_controller.h"
#include "subtitle_format.h" #include "subtitle_format.h"
@ -284,7 +283,7 @@ namespace Automation4 {
std::string include_paths = OPT_GET("Path/Automation/Include")->GetString(); std::string include_paths = OPT_GET("Path/Automation/Include")->GetString();
boost::char_separator<char> sep("|"); boost::char_separator<char> sep("|");
for (auto const& tok : boost::tokenizer<boost::char_separator<char>>(include_paths, sep)) { for (auto const& tok : boost::tokenizer<boost::char_separator<char>>(include_paths, sep)) {
auto path = StandardPaths::DecodePath(tok); auto path = config::path->Decode(tok);
if (path.is_absolute() && agi::fs::DirectoryExists(path)) if (path.is_absolute() && agi::fs::DirectoryExists(path))
include_path.emplace_back(std::move(path)); include_path.emplace_back(std::move(path));
} }
@ -355,7 +354,7 @@ namespace Automation4 {
boost::char_separator<char> sep("|"); boost::char_separator<char> sep("|");
for (auto const& tok : boost::tokenizer<boost::char_separator<char>>(path, sep)) { for (auto const& tok : boost::tokenizer<boost::char_separator<char>>(path, sep)) {
auto dirname = StandardPaths::DecodePath(tok); auto dirname = config::path->Decode(tok);
if (!agi::fs::DirectoryExists(dirname)) continue; if (!agi::fs::DirectoryExists(dirname)) continue;
for (auto filename : agi::fs::DirectoryIterator(dirname, "*.*")) { for (auto filename : agi::fs::DirectoryIterator(dirname, "*.*")) {

View file

@ -46,15 +46,16 @@
#include "compat.h" #include "compat.h"
#include "include/aegisub/context.h" #include "include/aegisub/context.h"
#include "main.h" #include "main.h"
#include "options.h"
#include "selection_controller.h" #include "selection_controller.h"
#include "subs_controller.h" #include "subs_controller.h"
#include "standard_paths.h"
#include "video_context.h" #include "video_context.h"
#include "utils.h" #include "utils.h"
#include <libaegisub/access.h> #include <libaegisub/access.h>
#include <libaegisub/fs.h> #include <libaegisub/fs.h>
#include <libaegisub/log.h> #include <libaegisub/log.h>
#include <libaegisub/path.h>
#include <libaegisub/scoped_ptr.h> #include <libaegisub/scoped_ptr.h>
#include <algorithm> #include <algorithm>
@ -726,7 +727,7 @@ namespace Automation4 {
{ {
std::string path = luaL_checkstring(L, 1); std::string path = luaL_checkstring(L, 1);
lua_pop(L, 1); lua_pop(L, 1);
push_value(L, StandardPaths::DecodePath(path)); push_value(L, config::path->Decode(path));
return 1; return 1;
} }

View file

@ -50,10 +50,11 @@
#include "../dialog_timing_processor.h" #include "../dialog_timing_processor.h"
#include "../dialog_translation.h" #include "../dialog_translation.h"
#include "../include/aegisub/context.h" #include "../include/aegisub/context.h"
#include "../standard_paths.h" #include "../options.h"
#include "../video_context.h" #include "../video_context.h"
#include <libaegisub/fs.h> #include <libaegisub/fs.h>
#include <libaegisub/path.h>
#include <wx/msgdlg.h> #include <wx/msgdlg.h>
#include <wx/utils.h> #include <wx/utils.h>
@ -72,7 +73,7 @@ struct tool_assdraw : public Command {
STR_HELP("Launch ASSDraw3 tool for vector drawing") STR_HELP("Launch ASSDraw3 tool for vector drawing")
void operator()(agi::Context *) { void operator()(agi::Context *) {
wxExecute("\"" + StandardPaths::DecodePath("?data/ASSDraw3.exe").wstring() + "\""); wxExecute("\"" + config::path->Decode("?data/ASSDraw3.exe").wstring() + "\"");
} }
}; };
@ -310,7 +311,7 @@ namespace cmd {
reg(new tool_time_postprocess); reg(new tool_time_postprocess);
reg(new tool_translation_assistant); reg(new tool_translation_assistant);
#ifdef _WIN32 #ifdef _WIN32
if (agi::fs::FileExists(StandardPaths::DecodePath("?data/ASSDraw3.exe"))) if (agi::fs::FileExists(config::path->Decode("?data/ASSDraw3.exe")))
reg(new tool_assdraw); reg(new tool_assdraw);
#endif #endif
reg(new tool_translation_assistant_commit); reg(new tool_translation_assistant_commit);

View file

@ -21,7 +21,8 @@
#include "compat.h" #include "compat.h"
#include "libresrc/libresrc.h" #include "libresrc/libresrc.h"
#include "options.h" #include "options.h"
#include "standard_paths.h"
#include <libaegisub/path.h>
#include <boost/range/adaptor/map.hpp> #include <boost/range/adaptor/map.hpp>
@ -90,7 +91,7 @@ DialogAutosave::DialogAutosave(wxWindow *parent)
} }
void DialogAutosave::Populate(std::map<wxString, AutosaveFile> &files_map, std::string const& path, wxString const& filter, wxString const& name_fmt) { void DialogAutosave::Populate(std::map<wxString, AutosaveFile> &files_map, std::string const& path, wxString const& filter, wxString const& name_fmt) {
wxString directory(StandardPaths::DecodePath(path).wstring()); wxString directory(config::path->Decode(path).wstring());
wxDir dir; wxDir dir;
if (!dir.Open(directory)) return; if (!dir.Open(directory)) return;

View file

@ -34,12 +34,12 @@
#include "options.h" #include "options.h"
#include "scintilla_text_ctrl.h" #include "scintilla_text_ctrl.h"
#include "selection_controller.h" #include "selection_controller.h"
#include "standard_paths.h"
#include "subs_controller.h" #include "subs_controller.h"
#include "utils.h" #include "utils.h"
#include <libaegisub/dispatch.h> #include <libaegisub/dispatch.h>
#include <libaegisub/fs.h> #include <libaegisub/fs.h>
#include <libaegisub/path.h>
#include <wx/button.h> #include <wx/button.h>
#include <wx/config.h> #include <wx/config.h>
@ -206,13 +206,13 @@ DialogFontsCollector::DialogFontsCollector(agi::Context *c)
collection_mode = new wxRadioBox(this, -1, _("Action"), wxDefaultPosition, wxDefaultSize, countof(modes), modes, 1); collection_mode = new wxRadioBox(this, -1, _("Action"), wxDefaultPosition, wxDefaultSize, countof(modes), modes, 1);
collection_mode->SetSelection(mid<int>(0, OPT_GET("Tool/Fonts Collector/Action")->GetInt(), 4)); collection_mode->SetSelection(mid<int>(0, OPT_GET("Tool/Fonts Collector/Action")->GetInt(), 4));
if (StandardPaths::DecodePath("?script") == "?script") if (config::path->Decode("?script") == "?script")
collection_mode->Enable(2, false); collection_mode->Enable(2, false);
wxStaticBoxSizer *destination_box = new wxStaticBoxSizer(wxVERTICAL, this, _("Destination")); wxStaticBoxSizer *destination_box = new wxStaticBoxSizer(wxVERTICAL, this, _("Destination"));
dest_label = new wxStaticText(this, -1, " "); dest_label = new wxStaticText(this, -1, " ");
dest_ctrl = new wxTextCtrl(this, -1, StandardPaths::DecodePath(OPT_GET("Path/Fonts Collector Destination")->GetString()).wstring()); dest_ctrl = new wxTextCtrl(this, -1, config::path->Decode(OPT_GET("Path/Fonts Collector Destination")->GetString()).wstring());
dest_browse_button = new wxButton(this, -1, _("&Browse...")); dest_browse_button = new wxButton(this, -1, _("&Browse..."));
wxSizer *dest_browse_sizer = new wxBoxSizer(wxHORIZONTAL); wxSizer *dest_browse_sizer = new wxBoxSizer(wxHORIZONTAL);
@ -268,7 +268,7 @@ void DialogFontsCollector::OnStart(wxCommandEvent &) {
int action = collection_mode->GetSelection(); int action = collection_mode->GetSelection();
OPT_SET("Tool/Fonts Collector/Action")->SetInt(action); OPT_SET("Tool/Fonts Collector/Action")->SetInt(action);
if (action != CheckFontsOnly) { if (action != CheckFontsOnly) {
dest = StandardPaths::DecodePath(action == CopyToScriptFolder ? "?script/" : from_wx(dest_ctrl->GetValue())); dest = config::path->Decode(action == CopyToScriptFolder ? "?script/" : from_wx(dest_ctrl->GetValue()));
if (action != CopyToZip) { if (action != CopyToZip) {
if (agi::fs::FileExists(dest)) if (agi::fs::FileExists(dest))
@ -372,7 +372,7 @@ void DialogFontsCollector::OnCollectionComplete(wxThreadEvent &) {
start_btn->Enable(); start_btn->Enable();
close_btn->Enable(); close_btn->Enable();
collection_mode->Enable(); collection_mode->Enable();
if (StandardPaths::DecodePath("?script") == "?script") if (config::path->Decode("?script") == "?script")
collection_mode->Enable(2, false); collection_mode->Enable(2, false);
wxCommandEvent evt; wxCommandEvent evt;

View file

@ -32,7 +32,6 @@
#include "libresrc/libresrc.h" #include "libresrc/libresrc.h"
#include "options.h" #include "options.h"
#include "subs_controller.h" #include "subs_controller.h"
#include "standard_paths.h"
#include "timeedit_ctrl.h" #include "timeedit_ctrl.h"
#include "video_context.h" #include "video_context.h"
@ -40,6 +39,7 @@
#include <libaegisub/io.h> #include <libaegisub/io.h>
#include <libaegisub/log.h> #include <libaegisub/log.h>
#include <libaegisub/of_type_adaptor.h> #include <libaegisub/of_type_adaptor.h>
#include <libaegisub/path.h>
#include <libaegisub/cajun/elements.h> #include <libaegisub/cajun/elements.h>
#include <libaegisub/cajun/reader.h> #include <libaegisub/cajun/reader.h>
@ -99,7 +99,7 @@ static wxString get_history_string(json::Object &obj) {
DialogShiftTimes::DialogShiftTimes(agi::Context *context) DialogShiftTimes::DialogShiftTimes(agi::Context *context)
: wxDialog(context->parent, -1, _("Shift Times")) : wxDialog(context->parent, -1, _("Shift Times"))
, context(context) , context(context)
, history_filename(StandardPaths::DecodePath("?user/shift_history.json")) , history_filename(config::path->Decode("?user/shift_history.json"))
, history(new json::Array) , history(new json::Array)
, timecodes_loaded_slot(context->videoController->AddTimecodesListener(&DialogShiftTimes::OnTimecodesLoaded, this)) , timecodes_loaded_slot(context->videoController->AddTimecodesListener(&DialogShiftTimes::OnTimecodesLoaded, this))
, selected_set_changed_slot(context->selectionController->AddSelectionListener(&DialogShiftTimes::OnSelectedSetChanged, this)) , selected_set_changed_slot(context->selectionController->AddSelectionListener(&DialogShiftTimes::OnSelectedSetChanged, this))

View file

@ -48,11 +48,11 @@
#include "persist_location.h" #include "persist_location.h"
#include "selection_controller.h" #include "selection_controller.h"
#include "subs_controller.h" #include "subs_controller.h"
#include "standard_paths.h"
#include "subtitle_format.h" #include "subtitle_format.h"
#include "utils.h" #include "utils.h"
#include <libaegisub/fs.h> #include <libaegisub/fs.h>
#include <libaegisub/path.h>
#include <libaegisub/of_type_adaptor.h> #include <libaegisub/of_type_adaptor.h>
#include <algorithm> #include <algorithm>
@ -322,7 +322,7 @@ void DialogStyleManager::LoadCatalog() {
CatalogList->Clear(); CatalogList->Clear();
// Get saved style catalogs // Get saved style catalogs
for (auto const& file : agi::fs::DirectoryIterator(StandardPaths::DecodePath("?user/catalog/"), "*.sty")) for (auto const& file : agi::fs::DirectoryIterator(config::path->Decode("?user/catalog/"), "*.sty"))
CatalogList->Append(agi::fs::path(file).stem().wstring()); CatalogList->Append(agi::fs::path(file).stem().wstring());
// Create a default storage if there are none // Create a default storage if there are none
@ -387,7 +387,7 @@ void DialogStyleManager::OnCatalogDelete() {
wxString message = wxString::Format(_("Are you sure you want to delete the storage \"%s\" from the catalog?"), name); wxString message = wxString::Format(_("Are you sure you want to delete the storage \"%s\" from the catalog?"), name);
int option = wxMessageBox(message, _("Confirm delete"), wxYES_NO | wxICON_EXCLAMATION , this); int option = wxMessageBox(message, _("Confirm delete"), wxYES_NO | wxICON_EXCLAMATION , this);
if (option == wxYES) { if (option == wxYES) {
agi::fs::Remove(StandardPaths::DecodePath("?user/catalog/" + from_wx(name) + ".sty")); agi::fs::Remove(config::path->Decode("?user/catalog/" + from_wx(name) + ".sty"));
CatalogList->Delete(CatalogList->GetSelection()); CatalogList->Delete(CatalogList->GetSelection());
CatalogList->SetSelection(0); CatalogList->SetSelection(0);
OnChangeCatalog(); OnChangeCatalog();

View file

@ -42,10 +42,10 @@
#include "frame_main.h" #include "frame_main.h"
#include "main.h" #include "main.h"
#include "options.h" #include "options.h"
#include "standard_paths.h"
#include "utils.h" #include "utils.h"
#include <libaegisub/fs.h> #include <libaegisub/fs.h>
#include <libaegisub/path.h>
#include <libaegisub/log.h> #include <libaegisub/log.h>
#include <boost/algorithm/string/predicate.hpp> #include <boost/algorithm/string/predicate.hpp>
@ -214,7 +214,7 @@ agi::fs::path FFmpegSourceProvider::GetCacheFilename(agi::fs::path const& filena
hash.process_bytes(filename.string().c_str(), filename.string().size()); hash.process_bytes(filename.string().c_str(), filename.string().size());
// Generate the filename // Generate the filename
auto result = StandardPaths::DecodePath("?local/ffms2cache/" + std::to_string(hash.checksum()) + "_" + std::to_string(len) + "_" + std::to_string(agi::fs::ModifiedTime(filename)) + ".ffindex"); auto result = config::path->Decode("?local/ffms2cache/" + std::to_string(hash.checksum()) + "_" + std::to_string(len) + "_" + std::to_string(agi::fs::ModifiedTime(filename)) + ".ffindex");
// Ensure that folder exists // Ensure that folder exists
agi::fs::CreateDirectory(result.parent_path()); agi::fs::CreateDirectory(result.parent_path());
@ -224,7 +224,7 @@ agi::fs::path FFmpegSourceProvider::GetCacheFilename(agi::fs::path const& filena
/// @brief Starts the cache cleaner thread /// @brief Starts the cache cleaner thread
void FFmpegSourceProvider::CleanCache() { void FFmpegSourceProvider::CleanCache() {
::CleanCache(StandardPaths::DecodePath("?local/ffms2cache/"), ::CleanCache(config::path->Decode("?local/ffms2cache/"),
"*.ffindex", "*.ffindex",
OPT_GET("Provider/FFmpegSource/Cache/Size")->GetInt(), OPT_GET("Provider/FFmpegSource/Cache/Size")->GetInt(),
OPT_GET("Provider/FFmpegSource/Cache/Files")->GetInt()); OPT_GET("Provider/FFmpegSource/Cache/Files")->GetInt());

View file

@ -36,7 +36,10 @@
#include "help_button.h" #include "help_button.h"
#include "standard_paths.h" #include "options.h"
#include <libaegisub/exception.h>
#include <libaegisub/path.h>
#include <boost/filesystem/path.hpp> #include <boost/filesystem/path.hpp>
#include <functional> #include <functional>
@ -44,8 +47,6 @@
#include <wx/filename.h> #include <wx/filename.h>
#include <libaegisub/exception.h>
static std::map<wxString,wxString> *pages = 0; static std::map<wxString,wxString> *pages = 0;
static void init_static() { static void init_static() {
@ -92,7 +93,7 @@ void HelpButton::OpenPage(wxString const& pageID) {
wxString section; wxString section;
page = page.BeforeFirst('#', &section); page = page.BeforeFirst('#', &section);
wxFileName docFile(StandardPaths::DecodePath("?data/docs/").wstring(), page, "html", wxPATH_NATIVE); wxFileName docFile(config::path->Decode("?data/docs/").wstring(), page, "html", wxPATH_NATIVE);
wxString url; wxString url;
// If we can read a file by the constructed name, assume we have a local copy of the manual // If we can read a file by the constructed name, assume we have a local copy of the manual

View file

@ -25,7 +25,8 @@
#include "libresrc/libresrc.h" #include "libresrc/libresrc.h"
#include "command/command.h" #include "command/command.h"
#include "options.h" #include "options.h"
#include "standard_paths.h"
#include <libaegisub/path.h>
namespace { namespace {
const char *removed_commands_6294[] = { const char *removed_commands_6294[] = {
@ -123,7 +124,7 @@ namespace hotkey {
agi::hotkey::Hotkey *inst = 0; agi::hotkey::Hotkey *inst = 0;
void init() { void init() {
inst = new agi::hotkey::Hotkey( inst = new agi::hotkey::Hotkey(
StandardPaths::DecodePath("?user/hotkey.json"), config::path->Decode("?user/hotkey.json"),
GET_DEFAULT_CONFIG(default_hotkey)); GET_DEFAULT_CONFIG(default_hotkey));
int last_version = OPT_GET("Version/Last Version")->GetInt(); int last_version = OPT_GET("Version/Last Version")->GetInt();

View file

@ -50,7 +50,6 @@
#include "libresrc/libresrc.h" #include "libresrc/libresrc.h"
#include "options.h" #include "options.h"
#include "plugin_manager.h" #include "plugin_manager.h"
#include "standard_paths.h"
#include "subs_controller.h" #include "subs_controller.h"
#include "subtitle_format.h" #include "subtitle_format.h"
#include "version.h" #include "version.h"
@ -140,13 +139,13 @@ bool AegisubApp::OnInit() {
#ifdef __WXMSW__ #ifdef __WXMSW__
// Try loading configuration from the install dir if one exists there // Try loading configuration from the install dir if one exists there
try { try {
auto conf_local(StandardPaths::DecodePath("?data/config.json")); auto conf_local(config::path->Decode("?data/config.json"));
std::unique_ptr<std::istream> localConfig(agi::io::Open(conf_local)); std::unique_ptr<std::istream> localConfig(agi::io::Open(conf_local));
config::opt = new agi::Options(conf_local, GET_DEFAULT_CONFIG(default_config)); config::opt = new agi::Options(conf_local, GET_DEFAULT_CONFIG(default_config));
// Local config, make ?user mean ?data so all user settings are placed in install dir // Local config, make ?user mean ?data so all user settings are placed in install dir
StandardPaths::SetPathValue("?user", StandardPaths::DecodePath("?data")); config::path->SetToken("?user", config::path->Decode("?data"));
StandardPaths::SetPathValue("?local", StandardPaths::DecodePath("?data")); config::path->SetToken("?local", config::path->Decode("?data"));
} catch (agi::fs::FileSystemError const&) { } catch (agi::fs::FileSystemError const&) {
// File doesn't exist or we can't read it // File doesn't exist or we can't read it
// Might be worth displaying an error in the second case // Might be worth displaying an error in the second case
@ -154,7 +153,7 @@ bool AegisubApp::OnInit() {
#endif #endif
StartupLog("Create log writer"); StartupLog("Create log writer");
auto path_log = StandardPaths::DecodePath("?user/log/"); auto path_log = config::path->Decode("?user/log/");
agi::fs::CreateDirectory(path_log); agi::fs::CreateDirectory(path_log);
agi::log::log->Subscribe(new agi::log::JsonEmitter(path_log)); agi::log::log->Subscribe(new agi::log::JsonEmitter(path_log));
CleanCache(path_log, "*.json", 10, 100); CleanCache(path_log, "*.json", 10, 100);
@ -162,7 +161,7 @@ bool AegisubApp::OnInit() {
StartupLog("Load user configuration"); StartupLog("Load user configuration");
try { try {
if (!config::opt) if (!config::opt)
config::opt = new agi::Options(StandardPaths::DecodePath("?user/config.json"), GET_DEFAULT_CONFIG(default_config)); config::opt = new agi::Options(config::path->Decode("?user/config.json"), GET_DEFAULT_CONFIG(default_config));
std::istringstream stream(GET_DEFAULT_CONFIG(default_config_platform)); std::istringstream stream(GET_DEFAULT_CONFIG(default_config_platform));
config::opt->ConfigNext(stream); config::opt->ConfigNext(stream);
} catch (agi::Exception& e) { } catch (agi::Exception& e) {
@ -186,7 +185,7 @@ bool AegisubApp::OnInit() {
icon::icon_init(); icon::icon_init();
StartupLog("Load MRU"); StartupLog("Load MRU");
config::mru = new agi::MRUManager(StandardPaths::DecodePath("?user/mru.json"), GET_DEFAULT_CONFIG(default_mru), config::opt); config::mru = new agi::MRUManager(config::path->Decode("?user/mru.json"), GET_DEFAULT_CONFIG(default_mru), config::opt);
agi::util::SetThreadName("AegiMain"); agi::util::SetThreadName("AegiMain");
@ -267,7 +266,7 @@ bool AegisubApp::OnInit() {
#endif #endif
StartupLog("Clean old autosave files"); StartupLog("Clean old autosave files");
CleanCache(StandardPaths::DecodePath(OPT_GET("Path/Auto/Save")->GetString()), "*.AUTOSAVE.ass", 100, 1000); CleanCache(config::path->Decode(OPT_GET("Path/Auto/Save")->GetString()), "*.AUTOSAVE.ass", 100, 1000);
StartupLog("Initialization complete"); StartupLog("Initialization complete");
return true; return true;
@ -307,7 +306,7 @@ public:
/// @brief Called at the start of walking the stack. /// @brief Called at the start of walking the stack.
/// @param cause cause of the crash. /// @param cause cause of the crash.
StackWalker::StackWalker(std::string const& cause) StackWalker::StackWalker(std::string const& cause)
: fp(StandardPaths::DecodePath("?user/crashlog.txt"), std::ios::app) : fp(config::path->Decode("?user/crashlog.txt"), std::ios::app)
{ {
if (!fp.good()) return; if (!fp.good()) return;
@ -343,7 +342,7 @@ const static wxString exception_message = _("Oops, Aegisub has crashed!\n\nAn at
static void UnhandledExeception(bool stackWalk, agi::Context *c) { static void UnhandledExeception(bool stackWalk, agi::Context *c) {
#if (!defined(_DEBUG) || defined(WITH_EXCEPTIONS)) && (wxUSE_ON_FATAL_EXCEPTION+0) #if (!defined(_DEBUG) || defined(WITH_EXCEPTIONS)) && (wxUSE_ON_FATAL_EXCEPTION+0)
if (c->ass && c->subsController) { if (c->ass && c->subsController) {
auto path = StandardPaths::DecodePath("?user/recovered"); auto path = config::path->Decode("?user/recovered");
agi::fs::CreateDirectory(path); agi::fs::CreateDirectory(path);
auto filename = c->subsController->Filename().stem(); auto filename = c->subsController->Filename().stem();
@ -415,7 +414,7 @@ int AegisubApp::OnRun() {
// Report errors // Report errors
if (!error.empty()) { if (!error.empty()) {
boost::filesystem::ofstream file(StandardPaths::DecodePath("?user/crashlog.txt"), std::ios::app); boost::filesystem::ofstream file(config::path->Decode("?user/crashlog.txt"), std::ios::app);
if (file.is_open()) { if (file.is_open()) {
file << agi::util::strftime("--- %y-%m-%d %H:%M:%S ------------------\n"); file << agi::util::strftime("--- %y-%m-%d %H:%M:%S ------------------\n");
file << boost::format("VER - %s\n") % GetAegisubLongVersionString(); file << boost::format("VER - %s\n") % GetAegisubLongVersionString();

View file

@ -29,11 +29,11 @@
#include "libresrc/libresrc.h" #include "libresrc/libresrc.h"
#include "main.h" #include "main.h"
#include "options.h" #include "options.h"
#include "standard_paths.h"
#include <libaegisub/hotkey.h> #include <libaegisub/hotkey.h>
#include <libaegisub/json.h> #include <libaegisub/json.h>
#include <libaegisub/log.h> #include <libaegisub/log.h>
#include <libaegisub/path.h>
#include <algorithm> #include <algorithm>
#include <deque> #include <deque>
@ -293,7 +293,7 @@ menu_map const& get_menus_root() {
if (!root.empty()) return root; if (!root.empty()) return root;
try { try {
root = agi::json_util::file(StandardPaths::DecodePath("?user/menu.json"), GET_DEFAULT_CONFIG(default_menu)); root = agi::json_util::file(config::path->Decode("?user/menu.json"), GET_DEFAULT_CONFIG(default_menu));
return root; return root;
} }
catch (json::Reader::ParseException const& e) { catch (json::Reader::ParseException const& e) {

View file

@ -16,6 +16,18 @@
/// @brief Base preferences dialogue classes /// @brief Base preferences dialogue classes
/// @ingroup configuration_ui /// @ingroup configuration_ui
#include "preferences_base.h"
#include "colour_button.h"
#include "compat.h"
#include "include/aegisub/audio_player.h"
#include "include/aegisub/audio_provider.h"
#include "libresrc/libresrc.h"
#include "options.h"
#include "preferences.h"
#include "video_provider_manager.h"
#include <libaegisub/path.h>
#include <wx/any.h> #include <wx/any.h>
#include <wx/checkbox.h> #include <wx/checkbox.h>
@ -29,19 +41,6 @@
#include <wx/spinctrl.h> #include <wx/spinctrl.h>
#include <wx/stattext.h> #include <wx/stattext.h>
#include <wx/treebook.h> #include <wx/treebook.h>
#include <wx/treebook.h>
#include "preferences_base.h"
#include "colour_button.h"
#include "compat.h"
#include "include/aegisub/audio_player.h"
#include "include/aegisub/audio_provider.h"
#include "libresrc/libresrc.h"
#include "options.h"
#include "preferences.h"
#include "standard_paths.h"
#include "video_provider_manager.h"
#define OPTION_UPDATER(type, evttype, opt, body) \ #define OPTION_UPDATER(type, evttype, opt, body) \
class type { \ class type { \
@ -63,7 +62,7 @@ OPTION_UPDATER(BoolUpdater, wxCommandEvent, OptionValueBool, !!evt.GetInt());
OPTION_UPDATER(ColourUpdater, wxThreadEvent, OptionValueColor, evt.GetPayload<agi::Color>()); OPTION_UPDATER(ColourUpdater, wxThreadEvent, OptionValueColor, evt.GetPayload<agi::Color>());
static void browse_button(wxTextCtrl *ctrl) { static void browse_button(wxTextCtrl *ctrl) {
wxDirDialog dlg(0, _("Please choose the folder:"), StandardPaths::DecodePath(from_wx(ctrl->GetValue())).wstring()); wxDirDialog dlg(0, _("Please choose the folder:"), config::path->Decode(from_wx(ctrl->GetValue())).wstring());
if (dlg.ShowModal() == wxID_OK) { if (dlg.ShowModal() == wxID_OK) {
wxString dir = dlg.GetPath(); wxString dir = dlg.GetPath();
if (!dir.empty()) if (!dir.empty())

View file

@ -24,13 +24,13 @@
#include "spellchecker_hunspell.h" #include "spellchecker_hunspell.h"
#include "options.h" #include "options.h"
#include "standard_paths.h"
#include <libaegisub/charset_conv.h> #include <libaegisub/charset_conv.h>
#include <libaegisub/fs.h> #include <libaegisub/fs.h>
#include <libaegisub/io.h> #include <libaegisub/io.h>
#include <libaegisub/line_iterator.h> #include <libaegisub/line_iterator.h>
#include <libaegisub/log.h> #include <libaegisub/log.h>
#include <libaegisub/path.h>
#include <hunspell/hunspell.hxx> #include <hunspell/hunspell.hxx>
@ -160,11 +160,11 @@ std::vector<std::string> HunspellSpellChecker::GetLanguageList() {
std::vector<std::string> dic, aff; std::vector<std::string> dic, aff;
// Get list of dictionaries // Get list of dictionaries
auto path = StandardPaths::DecodePath("?data/dictionaries/"); auto path = config::path->Decode("?data/dictionaries/");
agi::fs::DirectoryIterator(path, "*.dic").GetAll(dic); agi::fs::DirectoryIterator(path, "*.dic").GetAll(dic);
agi::fs::DirectoryIterator(path, "*.aff").GetAll(aff); agi::fs::DirectoryIterator(path, "*.aff").GetAll(aff);
path = StandardPaths::DecodePath(OPT_GET("Path/Dictionary")->GetString()); path = config::path->Decode(OPT_GET("Path/Dictionary")->GetString());
agi::fs::DirectoryIterator(path, "*.dic").GetAll(dic); agi::fs::DirectoryIterator(path, "*.dic").GetAll(dic);
agi::fs::DirectoryIterator(path, "*.aff").GetAll(aff); agi::fs::DirectoryIterator(path, "*.aff").GetAll(aff);
@ -200,15 +200,15 @@ void HunspellSpellChecker::OnLanguageChanged() {
auto language = OPT_GET("Tool/Spell Checker/Language")->GetString(); auto language = OPT_GET("Tool/Spell Checker/Language")->GetString();
if (language.empty()) return; if (language.empty()) return;
auto custDicRoot = StandardPaths::DecodePath(OPT_GET("Path/Dictionary")->GetString()); auto custDicRoot = config::path->Decode(OPT_GET("Path/Dictionary")->GetString());
auto dataDicRoot = StandardPaths::DecodePath("?data/dictionaries"); auto dataDicRoot = config::path->Decode("?data/dictionaries");
// If the user has a dic/aff pair in their dictionary path for this language // If the user has a dic/aff pair in their dictionary path for this language
// use that; otherwise use the one from Aegisub's install dir, adding words // use that; otherwise use the one from Aegisub's install dir, adding words
// from the dic in the user's dictionary path if it exists // from the dic in the user's dictionary path if it exists
auto affPath = custDicRoot/(language + ".aff"); auto affPath = custDicRoot/(language + ".aff");
auto dicPath = custDicRoot/(language + ".dic"); auto dicPath = custDicRoot/(language + ".dic");
userDicPath = StandardPaths::DecodePath("?user/dictionaries")/str(boost::format("user_%s.dic") % language); userDicPath = config::path->Decode("?user/dictionaries")/str(boost::format("user_%s.dic") % language);
if (!agi::fs::FileExists(affPath) || !agi::fs::FileExists(dicPath)) { if (!agi::fs::FileExists(affPath) || !agi::fs::FileExists(dicPath)) {
affPath = dataDicRoot/(language + ".aff"); affPath = dataDicRoot/(language + ".aff");
dicPath = dataDicRoot/(language + ".dic"); dicPath = dataDicRoot/(language + ".dic");

View file

@ -1,36 +0,0 @@
// Copyright (c) 2013, Thomas Goyne <plorkyeran@aegisub.org>
//
// Permission to use, copy, modify, and distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
//
// Aegisub Project http://www.aegisub.org/
/// @file standard_paths.cpp
/// @brief Encode and decode paths relative to various special locations
/// @ingroup utility
///
#include "config.h"
#include "standard_paths.h"
#include "options.h"
#include <libaegisub/path.h>
agi::fs::path StandardPaths::DecodePath(std::string const& path) {
return config::path->Decode(path);
}
void StandardPaths::SetPathValue(std::string const& path, agi::fs::path const& value) {
config::path->SetToken(path, value);
}

View file

@ -1,30 +0,0 @@
// Copyright (c) 2013, Thomas Goyne <plorkyeran@aegisub.org>
//
// Permission to use, copy, modify, and distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
//
// Aegisub Project http://www.aegisub.org/
/// @file standard_paths.h
/// @see standard_paths.cpp
/// @ingroup utility
///
#include <libaegisub/fs_fwd.h>
#include <string>
class StandardPaths {
public:
static agi::fs::path DecodePath(std::string const& path);
static void SetPathValue(std::string const& path, agi::fs::path const& value);
};

View file

@ -25,12 +25,12 @@
#include "command/command.h" #include "command/command.h"
#include "include/aegisub/context.h" #include "include/aegisub/context.h"
#include "options.h" #include "options.h"
#include "standard_paths.h"
#include "subtitle_format.h" #include "subtitle_format.h"
#include "text_file_reader.h" #include "text_file_reader.h"
#include "video_context.h" #include "video_context.h"
#include <libaegisub/fs.h> #include <libaegisub/fs.h>
#include <libaegisub/path.h>
#include <libaegisub/util.h> #include <libaegisub/util.h>
#include <boost/algorithm/string/predicate.hpp> #include <boost/algorithm/string/predicate.hpp>
@ -131,7 +131,7 @@ void SubsController::Load(agi::fs::path const& filename, std::string const& char
if (path_str.empty()) if (path_str.empty())
path = filename.parent_path(); path = filename.parent_path();
else else
path = StandardPaths::DecodePath(path_str); path = config::path->Decode(path_str);
agi::fs::CreateDirectory(path); agi::fs::CreateDirectory(path);
agi::fs::Copy(filename, path/(filename.stem().string() + ".ORIGINAL" + filename.extension().string())); agi::fs::Copy(filename, path/(filename.stem().string() + ".ORIGINAL" + filename.extension().string()));
} }
@ -148,10 +148,10 @@ void SubsController::Save(agi::fs::path const& filename, std::string const& enco
try { try {
autosaved_commit_id = saved_commit_id = commit_id; autosaved_commit_id = saved_commit_id = commit_id;
// Have to set these now for the sake of things that want to save paths // Have to set this now for the sake of things that want to save paths
// relative to the script in the header // relative to the script in the header
this->filename = filename; this->filename = filename;
StandardPaths::SetPathValue("?script", filename.parent_path()); config::path->SetToken("?script", filename.parent_path());
FileSave(); FileSave();
@ -196,7 +196,7 @@ agi::fs::path SubsController::AutoSave() {
if (commit_id == autosaved_commit_id) if (commit_id == autosaved_commit_id)
return ""; return "";
auto path = StandardPaths::DecodePath(OPT_GET("Path/Auto/Save")->GetString()); auto path = config::path->Decode(OPT_GET("Path/Auto/Save")->GetString());
if (path.empty()) if (path.empty())
path = filename.parent_path(); path = filename.parent_path();
@ -225,7 +225,7 @@ bool SubsController::CanSave() const {
void SubsController::SetFileName(agi::fs::path const& path) { void SubsController::SetFileName(agi::fs::path const& path) {
filename = path; filename = path;
StandardPaths::SetPathValue("?script", path.parent_path()); config::path->SetToken("?script", path.parent_path());
config::mru->Add("Subtitle", path); config::mru->Add("Subtitle", path);
OPT_SET("Path/Last/Subtitles")->SetString(filename.parent_path().string()); OPT_SET("Path/Last/Subtitles")->SetString(filename.parent_path().string());
} }

View file

@ -37,11 +37,12 @@
#ifdef WITH_CSRI #ifdef WITH_CSRI
#include "subtitles_provider_csri.h" #include "subtitles_provider_csri.h"
#include "options.h"
#include "subtitle_format.h" #include "subtitle_format.h"
#include "standard_paths.h"
#include "video_frame.h" #include "video_frame.h"
#include <libaegisub/fs.h> #include <libaegisub/fs.h>
#include <libaegisub/path.h>
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
#include <mutex> #include <mutex>
@ -79,7 +80,7 @@ CSRISubtitlesProvider::~CSRISubtitlesProvider() {
void CSRISubtitlesProvider::LoadSubtitles(AssFile *subs) { void CSRISubtitlesProvider::LoadSubtitles(AssFile *subs) {
if (tempfile.empty()) if (tempfile.empty())
tempfile = unique_path(StandardPaths::DecodePath("?temp/csri-%%%%-%%%%-%%%%-%%%%.ass")); tempfile = unique_path(config::path->Decode("?temp/csri-%%%%-%%%%-%%%%-%%%%.ass"));
SubtitleFormat::GetWriter(tempfile)->WriteFile(subs, tempfile, "utf-8"); SubtitleFormat::GetWriter(tempfile)->WriteFile(subs, tempfile, "utf-8");
std::lock_guard<std::mutex> lock(csri_mutex); std::lock_guard<std::mutex> lock(csri_mutex);

View file

@ -24,13 +24,13 @@
#include "thesaurus.h" #include "thesaurus.h"
#include "options.h" #include "options.h"
#include "standard_paths.h"
#include <boost/format.hpp> #include <boost/format.hpp>
#include <boost/algorithm/string/case_conv.hpp> #include <boost/algorithm/string/case_conv.hpp>
#include <libaegisub/fs.h> #include <libaegisub/fs.h>
#include <libaegisub/log.h> #include <libaegisub/log.h>
#include <libaegisub/path.h>
#include <libaegisub/thesaurus.h> #include <libaegisub/thesaurus.h>
Thesaurus::Thesaurus() Thesaurus::Thesaurus()
@ -56,11 +56,11 @@ std::vector<std::string> Thesaurus::GetLanguageList() const {
std::vector<std::string> idx, dat; std::vector<std::string> idx, dat;
// Get list of dictionaries // Get list of dictionaries
auto path = StandardPaths::DecodePath("?data/dictionaries/"); auto path = config::path->Decode("?data/dictionaries/");
agi::fs::DirectoryIterator(path, "th_*.idx").GetAll(idx); agi::fs::DirectoryIterator(path, "th_*.idx").GetAll(idx);
agi::fs::DirectoryIterator(path, "th_*.dat").GetAll(dat); agi::fs::DirectoryIterator(path, "th_*.dat").GetAll(dat);
path = StandardPaths::DecodePath(OPT_GET("Path/Dictionary")->GetString()); path = config::path->Decode(OPT_GET("Path/Dictionary")->GetString());
agi::fs::DirectoryIterator(path, "th_*.idx").GetAll(idx); agi::fs::DirectoryIterator(path, "th_*.idx").GetAll(idx);
agi::fs::DirectoryIterator(path, "th_*.dat").GetAll(dat); agi::fs::DirectoryIterator(path, "th_*.dat").GetAll(dat);
@ -96,7 +96,7 @@ void Thesaurus::OnLanguageChanged() {
auto language = OPT_GET("Tool/Thesaurus/Language")->GetString(); auto language = OPT_GET("Tool/Thesaurus/Language")->GetString();
if (language.empty()) return; if (language.empty()) return;
auto path = StandardPaths::DecodePath(OPT_GET("Path/Dictionary")->GetString() + "/"); auto path = config::path->Decode(OPT_GET("Path/Dictionary")->GetString() + "/");
// Get index and data paths // Get index and data paths
auto idxpath = path/str(boost::format("th_%s.idx") % language); auto idxpath = path/str(boost::format("th_%s.idx") % language);
@ -104,7 +104,7 @@ void Thesaurus::OnLanguageChanged() {
// If they aren't in the user dictionary path, check the application directory // If they aren't in the user dictionary path, check the application directory
if (!agi::fs::FileExists(idxpath) || !agi::fs::FileExists(datpath)) { if (!agi::fs::FileExists(idxpath) || !agi::fs::FileExists(datpath)) {
path = StandardPaths::DecodePath("?data/dictionaries/"); path = config::path->Decode("?data/dictionaries/");
idxpath = path/str(boost::format("th_%s.idx") % language); idxpath = path/str(boost::format("th_%s.idx") % language);
datpath = path/str(boost::format("th_%s.dat") % language); datpath = path/str(boost::format("th_%s.dat") % language);

View file

@ -35,16 +35,15 @@
#include "config.h" #include "config.h"
#ifdef WITH_AVISYNTH #ifdef WITH_AVISYNTH
#include "video_provider_avs.h" #include "video_provider_avs.h"
#include "options.h" #include "options.h"
#include "standard_paths.h"
#include <libaegisub/access.h> #include <libaegisub/access.h>
#include <libaegisub/charset_conv.h> #include <libaegisub/charset_conv.h>
#include <libaegisub/fs.h> #include <libaegisub/fs.h>
#include <libaegisub/log.h> #include <libaegisub/log.h>
#include <libaegisub/path.h>
#include <boost/algorithm/string/predicate.hpp> #include <boost/algorithm/string/predicate.hpp>
#include <mutex> #include <mutex>
@ -240,7 +239,7 @@ AVSValue AvisynthVideoProvider::Open(agi::fs::path const& filename) {
// Try loading DirectShowSource2 // Try loading DirectShowSource2
if (!env->FunctionExists("dss2")) { if (!env->FunctionExists("dss2")) {
auto dss2path(StandardPaths::DecodePath("?data/avss.dll")); auto dss2path(config::path->Decode("?data/avss.dll"));
if (agi::fs::FileExists(dss2path)) if (agi::fs::FileExists(dss2path))
env->Invoke("LoadPlugin", env->SaveString(agi::fs::ShortName(dss2path).c_str())); env->Invoke("LoadPlugin", env->SaveString(agi::fs::ShortName(dss2path).c_str()));
} }
@ -254,7 +253,7 @@ AVSValue AvisynthVideoProvider::Open(agi::fs::path const& filename) {
// Try DirectShowSource // Try DirectShowSource
// Load DirectShowSource.dll from app dir if it exists // Load DirectShowSource.dll from app dir if it exists
auto dsspath(StandardPaths::DecodePath("?data/DirectShowSource.dll")); auto dsspath(config::path->Decode("?data/DirectShowSource.dll"));
if (agi::fs::FileExists(dsspath)) if (agi::fs::FileExists(dsspath))
env->Invoke("LoadPlugin", env->SaveString(agi::fs::ShortName(dsspath).c_str())); env->Invoke("LoadPlugin", env->SaveString(agi::fs::ShortName(dsspath).c_str()));