mirror of https://github.com/odrling/Aegisub
Replaced all references to absolute paths with ?user, ?data or ?temp. Some bugs might have resulted, but it seems to work-ish.
Originally committed to SVN as r1277.
This commit is contained in:
parent
c4d94d4dfa
commit
d0fc49ca67
|
@ -43,7 +43,7 @@
|
||||||
#include <wx/filename.h>
|
#include <wx/filename.h>
|
||||||
#include <wx/choicdlg.h>
|
#include <wx/choicdlg.h>
|
||||||
#include "aegisublocale.h"
|
#include "aegisublocale.h"
|
||||||
#include "main.h"
|
#include "standard_paths.h"
|
||||||
|
|
||||||
|
|
||||||
///////////////
|
///////////////
|
||||||
|
@ -65,7 +65,7 @@ void AegisubLocale::Init(int language) {
|
||||||
curCode = language;
|
curCode = language;
|
||||||
locale = new wxLocale(language);
|
locale = new wxLocale(language);
|
||||||
#ifdef __WINDOWS__
|
#ifdef __WINDOWS__
|
||||||
locale->AddCatalogLookupPathPrefix(AegisubApp::folderName + _T("locale/"));
|
locale->AddCatalogLookupPathPrefix(StandardPaths::DecodePath(_T("?data/locale/")));
|
||||||
#endif
|
#endif
|
||||||
locale->AddCatalog(_T("aegisub"));
|
locale->AddCatalog(_T("aegisub"));
|
||||||
locale->AddCatalog(_T("wxstd"));
|
locale->AddCatalog(_T("wxstd"));
|
||||||
|
@ -115,7 +115,7 @@ wxArrayInt AegisubLocale::GetAvailableLanguages() {
|
||||||
wxString temp1;
|
wxString temp1;
|
||||||
|
|
||||||
// Open directory
|
// Open directory
|
||||||
wxString folder = AegisubApp::folderName + _T("/locale/");
|
wxString folder = StandardPaths::DecodePath(_T("?data/locale/"));
|
||||||
wxDir dir;
|
wxDir dir;
|
||||||
if (!dir.Exists(folder)) return final;
|
if (!dir.Exists(folder)) return final;
|
||||||
if (!dir.Open(folder)) return final;
|
if (!dir.Open(folder)) return final;
|
||||||
|
|
|
@ -36,13 +36,13 @@
|
||||||
|
|
||||||
////////////
|
////////////
|
||||||
// Includes
|
// Includes
|
||||||
|
#include <fstream>
|
||||||
#include "ass_style_storage.h"
|
#include "ass_style_storage.h"
|
||||||
#include "ass_style.h"
|
#include "ass_style.h"
|
||||||
#include "ass_file.h"
|
#include "ass_file.h"
|
||||||
#include "main.h"
|
|
||||||
#include "text_file_reader.h"
|
#include "text_file_reader.h"
|
||||||
#include "text_file_writer.h"
|
#include "text_file_writer.h"
|
||||||
#include <fstream>
|
#include "standard_paths.h"
|
||||||
|
|
||||||
|
|
||||||
///////////////////////
|
///////////////////////
|
||||||
|
@ -50,12 +50,7 @@
|
||||||
void AssStyleStorage::Save(wxString name) {
|
void AssStyleStorage::Save(wxString name) {
|
||||||
if (name.IsEmpty()) return;
|
if (name.IsEmpty()) return;
|
||||||
|
|
||||||
wxString filename = AegisubApp::folderName;
|
TextFileWriter file(StandardPaths::DecodePath(_T("?data/catalog/")+name+_T(".sty")), _T("UTF-8"));
|
||||||
filename += _T("/catalog/");
|
|
||||||
filename += name;
|
|
||||||
filename += _T(".sty");
|
|
||||||
|
|
||||||
TextFileWriter file(filename, _T("UTF-8"));
|
|
||||||
|
|
||||||
for (std::list<AssStyle*>::iterator cur=style.begin();cur!=style.end();cur++) {
|
for (std::list<AssStyle*>::iterator cur=style.begin();cur!=style.end();cur++) {
|
||||||
file.WriteLineToFile((*cur)->GetEntryData());
|
file.WriteLineToFile((*cur)->GetEntryData());
|
||||||
|
@ -67,15 +62,9 @@ void AssStyleStorage::Save(wxString name) {
|
||||||
// Load styles from disk
|
// Load styles from disk
|
||||||
void AssStyleStorage::Load(wxString name) {
|
void AssStyleStorage::Load(wxString name) {
|
||||||
if (name.IsEmpty()) return;
|
if (name.IsEmpty()) return;
|
||||||
|
|
||||||
wxString filename = AegisubApp::folderName;
|
|
||||||
filename += _T("/catalog/");
|
|
||||||
filename += name;
|
|
||||||
filename += _T(".sty");
|
|
||||||
|
|
||||||
Clear();
|
Clear();
|
||||||
|
|
||||||
TextFileReader file(filename, _T("UTF-8"));
|
TextFileReader file(StandardPaths::DecodePath(_T("?data/catalog/")+name+_T(".sty")), _T("UTF-8"));
|
||||||
|
|
||||||
AssStyle *curStyle;
|
AssStyle *curStyle;
|
||||||
while (file.HasMoreLines()) {
|
while (file.HasMoreLines()) {
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
#include <wx/filefn.h>
|
#include <wx/filefn.h>
|
||||||
#include "dialog_progress.h"
|
#include "dialog_progress.h"
|
||||||
#include "audio_provider_hd.h"
|
#include "audio_provider_hd.h"
|
||||||
#include "main.h"
|
#include "standard_paths.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
|
@ -142,10 +142,10 @@ void HDAudioProvider::GetAudio(void *buf, __int64 start, __int64 count) {
|
||||||
wxString HDAudioProvider::DiskCachePath() {
|
wxString HDAudioProvider::DiskCachePath() {
|
||||||
// Default
|
// Default
|
||||||
wxString path = Options.AsText(_T("Audio HD Cache Location"));
|
wxString path = Options.AsText(_T("Audio HD Cache Location"));
|
||||||
if (path == _T("default")) return AegisubApp::folderName;
|
if (path == _T("default")) return StandardPaths::DecodePath(_T("?temp/"));
|
||||||
|
|
||||||
// Specified
|
// Specified
|
||||||
return DecodeRelativePath(path,AegisubApp::folderName);
|
return DecodeRelativePath(path,StandardPaths::DecodePath(_T("?user/")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "string_codec.h"
|
#include "string_codec.h"
|
||||||
#include "ass_file.h"
|
#include "ass_file.h"
|
||||||
|
#include "standard_paths.h"
|
||||||
#include <wx/filename.h>
|
#include <wx/filename.h>
|
||||||
#include <wx/dir.h>
|
#include <wx/dir.h>
|
||||||
#include <wx/dialog.h>
|
#include <wx/dialog.h>
|
||||||
|
@ -515,7 +516,7 @@ namespace Automation4 {
|
||||||
wxStringTokenizer toker(Options.AsText(_T("Automation Include Path")), _T("|"), wxTOKEN_STRTOK);
|
wxStringTokenizer toker(Options.AsText(_T("Automation Include Path")), _T("|"), wxTOKEN_STRTOK);
|
||||||
while (toker.HasMoreTokens()) {
|
while (toker.HasMoreTokens()) {
|
||||||
// todo? make some error reporting here
|
// todo? make some error reporting here
|
||||||
wxFileName path(toker.GetNextToken());
|
wxFileName path(StandardPaths::DecodePath(toker.GetNextToken()));
|
||||||
if (!path.IsOk()) continue;
|
if (!path.IsOk()) continue;
|
||||||
if (path.IsRelative()) continue;
|
if (path.IsRelative()) continue;
|
||||||
if (!path.DirExists()) continue;
|
if (!path.DirExists()) continue;
|
||||||
|
@ -648,18 +649,18 @@ namespace Automation4 {
|
||||||
wxStringTokenizer tok(path, _T("|"), wxTOKEN_STRTOK);
|
wxStringTokenizer tok(path, _T("|"), wxTOKEN_STRTOK);
|
||||||
while (tok.HasMoreTokens()) {
|
while (tok.HasMoreTokens()) {
|
||||||
wxDir dir;
|
wxDir dir;
|
||||||
wxString dirname = tok.GetNextToken();
|
wxString dirname = StandardPaths::DecodePath(tok.GetNextToken());
|
||||||
if (!dir.Exists(dirname)) {
|
if (!dir.Exists(dirname)) {
|
||||||
wxLogWarning(_T("A directory was specified in the Automation autoload path, but it doesn't exist: %s"), dirname.c_str());
|
//wxLogWarning(_T("A directory was specified in the Automation autoload path, but it doesn't exist: %s"), dirname.c_str());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!dir.Open(dirname)) {
|
if (!dir.Open(dirname)) {
|
||||||
wxLogWarning(_T("Failed to open a directory in the Automation autoload path: %s"), dirname.c_str());
|
//wxLogWarning(_T("Failed to open a directory in the Automation autoload path: %s"), dirname.c_str());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString fn;
|
wxString fn;
|
||||||
wxFileName script_path(path, _T(""));
|
wxFileName script_path(dirname + _T("/"), _T(""));
|
||||||
bool more = dir.GetFirst(&fn, wxEmptyString, wxDIR_FILES);
|
bool more = dir.GetFirst(&fn, wxEmptyString, wxDIR_FILES);
|
||||||
while (more) {
|
while (more) {
|
||||||
script_path.SetName(fn);
|
script_path.SetName(fn);
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
#include <wx/fontdlg.h>
|
#include <wx/fontdlg.h>
|
||||||
#include "browse_button.h"
|
#include "browse_button.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "main.h"
|
#include "standard_paths.h"
|
||||||
|
|
||||||
|
|
||||||
///////////////
|
///////////////
|
||||||
|
@ -68,8 +68,8 @@ void BrowseButton::Bind(wxTextCtrl *control,int pos) {
|
||||||
void BrowseButton::OnPressed(wxCommandEvent &event) {
|
void BrowseButton::OnPressed(wxCommandEvent &event) {
|
||||||
// Folder
|
// Folder
|
||||||
if (type == BROWSE_FOLDER) {
|
if (type == BROWSE_FOLDER) {
|
||||||
wxString def = DecodeRelativePath(ctrl[0]->GetValue(),AegisubApp::folderName);
|
wxString def = DecodeRelativePath(ctrl[0]->GetValue(),StandardPaths::DecodePath(_T("?user/")));
|
||||||
wxString dir = MakeRelativePath(wxDirSelector(_("Please choose the folder:"),def),AegisubApp::folderName);
|
wxString dir = MakeRelativePath(wxDirSelector(_("Please choose the folder:"),def),StandardPaths::DecodePath(_T("?user/")));
|
||||||
if (dir != _T("")) ctrl[0]->SetValue(dir);
|
if (dir != _T("")) ctrl[0]->SetValue(dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,8 +44,9 @@
|
||||||
#endif
|
#endif
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include <wx/spinctrl.h>
|
#include <wx/spinctrl.h>
|
||||||
|
#include <wx/stdpaths.h>
|
||||||
#include "frame_main.h"
|
#include "frame_main.h"
|
||||||
#include "main.h"
|
#include "standard_paths.h"
|
||||||
#include "validators.h"
|
#include "validators.h"
|
||||||
#include "colour_button.h"
|
#include "colour_button.h"
|
||||||
#include "subs_edit_box.h"
|
#include "subs_edit_box.h"
|
||||||
|
@ -709,7 +710,10 @@ void DialogOptions::OnOK(wxCommandEvent &event) {
|
||||||
int answer = wxMessageBox(_("Aegisub must restart for the changes to take effect. Restart now?"),_("Restart Aegisub"),wxYES_NO);
|
int answer = wxMessageBox(_("Aegisub must restart for the changes to take effect. Restart now?"),_("Restart Aegisub"),wxYES_NO);
|
||||||
if (answer == wxYES) {
|
if (answer == wxYES) {
|
||||||
FrameMain *frame = (FrameMain*) GetParent();
|
FrameMain *frame = (FrameMain*) GetParent();
|
||||||
if (frame->Close()) wxExecute(AegisubApp::fullPath);
|
if (frame->Close()) {
|
||||||
|
wxStandardPaths stand;
|
||||||
|
wxExecute(stand.GetExecutablePath());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -739,7 +743,10 @@ void DialogOptions::OnCancel(wxCommandEvent &event) {
|
||||||
int answer = wxMessageBox(_("Aegisub must restart for the changes to take effect. Restart now?"),_("Restart Aegisub"),wxYES_NO);
|
int answer = wxMessageBox(_("Aegisub must restart for the changes to take effect. Restart now?"),_("Restart Aegisub"),wxYES_NO);
|
||||||
if (answer == wxYES) {
|
if (answer == wxYES) {
|
||||||
FrameMain *frame = (FrameMain*) GetParent();
|
FrameMain *frame = (FrameMain*) GetParent();
|
||||||
if (frame->Close()) wxExecute(AegisubApp::fullPath);
|
if (frame->Close()) {
|
||||||
|
wxStandardPaths stand;
|
||||||
|
wxExecute(stand.GetExecutablePath());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -871,7 +878,10 @@ void DialogOptions::WriteToOptions(bool justApply) {
|
||||||
int answer = wxMessageBox(_("Aegisub must restart for the changes to take effect. Restart now?"),_("Restart Aegisub"),wxYES_NO);
|
int answer = wxMessageBox(_("Aegisub must restart for the changes to take effect. Restart now?"),_("Restart Aegisub"),wxYES_NO);
|
||||||
if (answer == wxYES) {
|
if (answer == wxYES) {
|
||||||
FrameMain *frame = (FrameMain*) GetParent();
|
FrameMain *frame = (FrameMain*) GetParent();
|
||||||
if (frame->Close()) wxExecute(AegisubApp::fullPath);
|
if (frame->Close()) {
|
||||||
|
wxStandardPaths stand;
|
||||||
|
wxExecute(stand.GetExecutablePath());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,21 +40,19 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <wx/filename.h>
|
#include <wx/filename.h>
|
||||||
|
#include <wx/filefn.h>
|
||||||
#include "dialog_shift_times.h"
|
#include "dialog_shift_times.h"
|
||||||
#include "video_display.h"
|
#include "video_display.h"
|
||||||
#include "vfr.h"
|
#include "vfr.h"
|
||||||
#include "subs_grid.h"
|
#include "subs_grid.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "main.h"
|
#include "standard_paths.h"
|
||||||
#include "ass_file.h"
|
#include "ass_file.h"
|
||||||
#include "ass_time.h"
|
#include "ass_time.h"
|
||||||
#include "ass_dialogue.h"
|
#include "ass_dialogue.h"
|
||||||
#include "subs_edit_box.h"
|
#include "subs_edit_box.h"
|
||||||
|
|
||||||
|
|
||||||
#define SHIFT_HISTORY_FILE (AegisubApp::folderName + _T("shift_history.txt"))
|
|
||||||
|
|
||||||
|
|
||||||
///////////////
|
///////////////
|
||||||
// Constructor
|
// Constructor
|
||||||
DialogShiftTimes::DialogShiftTimes (wxWindow *parent,SubtitlesGrid *_grid)
|
DialogShiftTimes::DialogShiftTimes (wxWindow *parent,SubtitlesGrid *_grid)
|
||||||
|
@ -172,7 +170,7 @@ DialogShiftTimes::DialogShiftTimes (wxWindow *parent,SubtitlesGrid *_grid)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load history
|
// Load history
|
||||||
LoadHistory(SHIFT_HISTORY_FILE);
|
LoadHistory(StandardPaths::DecodePath(_T("?user/shift_history.txt")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -190,7 +188,7 @@ END_EVENT_TABLE()
|
||||||
/////////////////
|
/////////////////
|
||||||
// Clear History
|
// Clear History
|
||||||
void DialogShiftTimes::OnClear(wxCommandEvent &event) {
|
void DialogShiftTimes::OnClear(wxCommandEvent &event) {
|
||||||
remove(SHIFT_HISTORY_FILE.mb_str(wxConvLocal));
|
wxRemoveFile(StandardPaths::DecodePath(_T("?user/shift_history.txt")));
|
||||||
History->Clear();
|
History->Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
#include "ass_style.h"
|
#include "ass_style.h"
|
||||||
#include "ass_file.h"
|
#include "ass_file.h"
|
||||||
#include "ass_dialogue.h"
|
#include "ass_dialogue.h"
|
||||||
#include "main.h"
|
#include "standard_paths.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "subs_grid.h"
|
#include "subs_grid.h"
|
||||||
|
|
||||||
|
@ -203,8 +203,7 @@ void DialogStyleManager::LoadCatalog () {
|
||||||
CatalogList->Clear();
|
CatalogList->Clear();
|
||||||
|
|
||||||
// Create catalog if it doesn't exist
|
// Create catalog if it doesn't exist
|
||||||
wxString dirname = AegisubApp::folderName;
|
wxString dirname = StandardPaths::DecodePath(_T("?user/catalog/"));
|
||||||
dirname += _T("/catalog/");
|
|
||||||
if (!wxDirExists(dirname)) {
|
if (!wxDirExists(dirname)) {
|
||||||
if (!wxMkdir(dirname)) {
|
if (!wxMkdir(dirname)) {
|
||||||
throw _T("Error creating directory!");
|
throw _T("Error creating directory!");
|
||||||
|
@ -219,8 +218,7 @@ void DialogStyleManager::LoadCatalog () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get dir
|
// Get dir
|
||||||
dirname = AegisubApp::folderName;
|
dirname = StandardPaths::DecodePath(_T("?user/catalog/*.sty"));
|
||||||
dirname += _T("/catalog/*.sty");
|
|
||||||
|
|
||||||
// Populate
|
// Populate
|
||||||
wxString curfile = wxFindFirstFile(dirname,wxFILE);
|
wxString curfile = wxFindFirstFile(dirname,wxFILE);
|
||||||
|
@ -411,8 +409,7 @@ void DialogStyleManager::OnCatalogNew (wxCommandEvent &event) {
|
||||||
StorageActions(true);
|
StorageActions(true);
|
||||||
|
|
||||||
// Save
|
// Save
|
||||||
wxString dirname = AegisubApp::folderName;
|
wxString dirname = StandardPaths::DecodePath(_T("?user/catalog/"));
|
||||||
dirname += _T("/catalog/");
|
|
||||||
if (!wxDirExists(dirname)) {
|
if (!wxDirExists(dirname)) {
|
||||||
if (!wxMkdir(dirname)) {
|
if (!wxMkdir(dirname)) {
|
||||||
throw _T("Error creating directory!");
|
throw _T("Error creating directory!");
|
||||||
|
@ -435,11 +432,7 @@ void DialogStyleManager::OnCatalogDelete (wxCommandEvent &event) {
|
||||||
message += _("\" from the catalog?");
|
message += _("\" from the catalog?");
|
||||||
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) {
|
||||||
wxString filename = AegisubApp::folderName;
|
wxRemoveFile(StandardPaths::DecodePath(_T("?user/catalog/") + name + _T(".sty")));
|
||||||
filename += _T("/catalog/");
|
|
||||||
filename += name;
|
|
||||||
filename += _T(".sty");
|
|
||||||
wxRemoveFile(filename);
|
|
||||||
CatalogList->Delete(sel);
|
CatalogList->Delete(sel);
|
||||||
StorageList->Clear();
|
StorageList->Clear();
|
||||||
StorageActions(false);
|
StorageActions(false);
|
||||||
|
|
|
@ -596,7 +596,7 @@ void FrameMain::LoadSubtitles (wxString filename,wxString charset) {
|
||||||
wxString path = Options.AsText(_T("Auto backup path"));
|
wxString path = Options.AsText(_T("Auto backup path"));
|
||||||
if (path.IsEmpty()) path = origfile.GetPath();
|
if (path.IsEmpty()) path = origfile.GetPath();
|
||||||
wxFileName dstpath(path);
|
wxFileName dstpath(path);
|
||||||
if (!dstpath.IsAbsolute()) path = AegisubApp::folderName + path;
|
if (!dstpath.IsAbsolute()) path = StandardPaths::DecodePath(_T("?user/") + path);
|
||||||
path += _T("/");
|
path += _T("/");
|
||||||
dstpath.Assign(path);
|
dstpath.Assign(path);
|
||||||
if (!dstpath.DirExists()) wxMkdir(path);
|
if (!dstpath.DirExists()) wxMkdir(path);
|
||||||
|
@ -1140,7 +1140,7 @@ void FrameMain::OpenHelp(wxString page) {
|
||||||
if (!page.IsEmpty()) page = _T("::") + page;
|
if (!page.IsEmpty()) page = _T("::") + page;
|
||||||
wxFileType *type = wxTheMimeTypesManager->GetFileTypeFromExtension(_T("chm"));
|
wxFileType *type = wxTheMimeTypesManager->GetFileTypeFromExtension(_T("chm"));
|
||||||
if (type) {
|
if (type) {
|
||||||
wxString command = type->GetOpenCommand(AegisubApp::folderName + _T("Aegisub.chm"));
|
wxString command = type->GetOpenCommand(StandardPaths::DecodePath(_T("?data/Aegisub.chm")));
|
||||||
if (!command.empty()) wxExecute(command + page);
|
if (!command.empty()) wxExecute(command + page);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
#include <wx/filename.h>
|
#include <wx/filename.h>
|
||||||
#include <wx/tglbtn.h>
|
#include <wx/tglbtn.h>
|
||||||
#include <wx/rawbmp.h>
|
#include <wx/rawbmp.h>
|
||||||
|
#include <wx/stdpaths.h>
|
||||||
#include "subs_grid.h"
|
#include "subs_grid.h"
|
||||||
#include "frame_main.h"
|
#include "frame_main.h"
|
||||||
#include "video_display.h"
|
#include "video_display.h"
|
||||||
|
@ -80,6 +81,7 @@
|
||||||
#include "dialog_dummy_video.h"
|
#include "dialog_dummy_video.h"
|
||||||
#include "dialog_spellchecker.h"
|
#include "dialog_spellchecker.h"
|
||||||
#include "dialog_associations.h"
|
#include "dialog_associations.h"
|
||||||
|
#include "standard_paths.h"
|
||||||
|
|
||||||
|
|
||||||
////////////////////
|
////////////////////
|
||||||
|
@ -1352,7 +1354,7 @@ void FrameMain::OnAutoSave(wxTimerEvent &event) {
|
||||||
wxString path = Options.AsText(_T("Auto save path"));
|
wxString path = Options.AsText(_T("Auto save path"));
|
||||||
if (path.IsEmpty()) path = origfile.GetPath();
|
if (path.IsEmpty()) path = origfile.GetPath();
|
||||||
wxFileName dstpath(path);
|
wxFileName dstpath(path);
|
||||||
if (!dstpath.IsAbsolute()) path = AegisubApp::folderName + path;
|
if (!dstpath.IsAbsolute()) path = StandardPaths::DecodePath(_T("?user/") + path);
|
||||||
path += _T("/");
|
path += _T("/");
|
||||||
dstpath.Assign(path);
|
dstpath.Assign(path);
|
||||||
if (!dstpath.DirExists()) wxMkdir(path);
|
if (!dstpath.DirExists()) wxMkdir(path);
|
||||||
|
@ -1517,7 +1519,10 @@ void FrameMain::OnChooseLanguage (wxCommandEvent &event) {
|
||||||
int result = wxMessageBox(_T("Aegisub needs to be restarted so that the new language can be applied. Restart now?"),_T("Restart Aegisub?"),wxICON_QUESTION | wxYES_NO);
|
int result = wxMessageBox(_T("Aegisub needs to be restarted so that the new language can be applied. Restart now?"),_T("Restart Aegisub?"),wxICON_QUESTION | wxYES_NO);
|
||||||
if (result == wxYES) {
|
if (result == wxYES) {
|
||||||
// Restart Aegisub
|
// Restart Aegisub
|
||||||
if (Close()) wxExecute(AegisubApp::fullPath);
|
if (Close()) {
|
||||||
|
wxStandardPaths stand;
|
||||||
|
wxExecute(stand.GetExecutablePath());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,6 +42,7 @@
|
||||||
#include <wx/msgdlg.h>
|
#include <wx/msgdlg.h>
|
||||||
#include <wx/mimetype.h>
|
#include <wx/mimetype.h>
|
||||||
#include <wx/utils.h>
|
#include <wx/utils.h>
|
||||||
|
#include <wx/stdpaths.h>
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "frame_main.h"
|
#include "frame_main.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
|
@ -58,6 +59,7 @@
|
||||||
#include "auto4_base.h"
|
#include "auto4_base.h"
|
||||||
#include "subtitle_format.h"
|
#include "subtitle_format.h"
|
||||||
#include "video_context.h"
|
#include "video_context.h"
|
||||||
|
#include "standard_paths.h"
|
||||||
|
|
||||||
|
|
||||||
///////////////////
|
///////////////////
|
||||||
|
@ -85,14 +87,12 @@ bool AegisubApp::OnInit() {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Set config file
|
// Set config file
|
||||||
GetFullPath(argv[0]);
|
Options.SetFile(StandardPaths::DecodePath(_T("?user/config.dat")));
|
||||||
GetFolderName();
|
|
||||||
Options.SetFile(folderName + _T("/config.dat"));
|
|
||||||
Options.Load();
|
Options.Load();
|
||||||
AssTime::UseMSPrecision = Options.AsBool(_T("Use nonstandard Milisecond Times"));
|
AssTime::UseMSPrecision = Options.AsBool(_T("Use nonstandard Milisecond Times"));
|
||||||
|
|
||||||
// Set hotkeys file
|
// Set hotkeys file
|
||||||
Hotkeys.SetFile(folderName + _T("/hotkeys.dat"));
|
Hotkeys.SetFile(StandardPaths::DecodePath(_T("?user/hotkeys.dat")));
|
||||||
Hotkeys.Load();
|
Hotkeys.Load();
|
||||||
|
|
||||||
#ifdef __WINDOWS__
|
#ifdef __WINDOWS__
|
||||||
|
@ -217,7 +217,7 @@ void StackWalker::OnStackFrame(const wxStackFrame &frame) {
|
||||||
}
|
}
|
||||||
|
|
||||||
StackWalker::StackWalker() {
|
StackWalker::StackWalker() {
|
||||||
file.open(wxString(AegisubApp::folderName + _T("/stack.txt")).mb_str(),std::ios::out | std::ios::app);
|
file.open(wxString(StandardPaths::DecodePath(_T("?user/stack.txt"))).mb_str(),std::ios::out | std::ios::app);
|
||||||
if (file.is_open()) {
|
if (file.is_open()) {
|
||||||
file << std::endl << "Begining stack dump:\n";
|
file << std::endl << "Begining stack dump:\n";
|
||||||
}
|
}
|
||||||
|
@ -268,7 +268,9 @@ void AegisubApp::RegistryAssociate () {
|
||||||
#if defined(__WINDOWS__)
|
#if defined(__WINDOWS__)
|
||||||
// Command to open with this
|
// Command to open with this
|
||||||
wxString command;
|
wxString command;
|
||||||
command << _T("\"") << fullPath << _T("\" \"%1\"");
|
wxStandardPaths stand;
|
||||||
|
wxString fullPath = stand.GetExecutablePath();
|
||||||
|
command = _T("\"") + fullPath + _T("\" \"%1\"");
|
||||||
|
|
||||||
// Main program association
|
// Main program association
|
||||||
wxRegKey *key = new wxRegKey(_T("HKEY_CURRENT_USER\\Software\\Classes\\Aegisub"));
|
wxRegKey *key = new wxRegKey(_T("HKEY_CURRENT_USER\\Software\\Classes\\Aegisub"));
|
||||||
|
@ -317,66 +319,6 @@ void AegisubApp::RegistryAssociate () {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////
|
|
||||||
// Gets and stores full path
|
|
||||||
void AegisubApp::GetFullPath(wxString arg) {
|
|
||||||
if (wxIsAbsolutePath(arg)) {
|
|
||||||
fullPath = arg;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Is it a relative path?
|
|
||||||
wxString currentDir(wxFileName::GetCwd());
|
|
||||||
if (currentDir.Last() != wxFILE_SEP_PATH) currentDir += wxFILE_SEP_PATH;
|
|
||||||
wxString str = currentDir + arg;
|
|
||||||
if (wxFileExists(str)) {
|
|
||||||
fullPath = str;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// OK, it's neither an absolute path nor a relative path.
|
|
||||||
// Search PATH.
|
|
||||||
wxPathList pathList;
|
|
||||||
pathList.AddEnvList(_T("PATH"));
|
|
||||||
str = pathList.FindAbsoluteValidPath(arg);
|
|
||||||
if (!str.IsEmpty()) {
|
|
||||||
fullPath = str;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
fullPath = _T("");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////
|
|
||||||
// Gets folder name from full path
|
|
||||||
void AegisubApp::GetFolderName () {
|
|
||||||
#if defined(__WINDOWS__)
|
|
||||||
folderName = _T("");
|
|
||||||
wxFileName path(fullPath);
|
|
||||||
#elif defined(__APPLE__)
|
|
||||||
wxFileName path;
|
|
||||||
path.AssignHomeDir();
|
|
||||||
path.AppendDir(_T("Library"));
|
|
||||||
path.AppendDir(_T("Application Support"));
|
|
||||||
if (!path.DirExists())
|
|
||||||
path.Mkdir();
|
|
||||||
path.AppendDir(_T("Aegisub"));
|
|
||||||
if (!path.DirExists())
|
|
||||||
path.Mkdir();
|
|
||||||
#else
|
|
||||||
wxFileName path;
|
|
||||||
path.AssignHomeDir();
|
|
||||||
path.AppendDir(_T(".aegisub"));
|
|
||||||
if (!path.DirExists())
|
|
||||||
path.Mkdir();
|
|
||||||
#endif
|
|
||||||
folderName += path.GetPath(wxPATH_GET_VOLUME);
|
|
||||||
folderName += _T("/");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////
|
////////////
|
||||||
// Open URL
|
// Open URL
|
||||||
void AegisubApp::OpenURL(wxString url) {
|
void AegisubApp::OpenURL(wxString url) {
|
||||||
|
@ -397,12 +339,6 @@ void AegisubApp::MacOpenFile(const wxString &filename) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
///////////
|
|
||||||
// Statics
|
|
||||||
wxString AegisubApp::fullPath;
|
|
||||||
wxString AegisubApp::folderName;
|
|
||||||
|
|
||||||
|
|
||||||
///////////////
|
///////////////
|
||||||
// Event table
|
// Event table
|
||||||
BEGIN_EVENT_TABLE(AegisubApp,wxApp)
|
BEGIN_EVENT_TABLE(AegisubApp,wxApp)
|
||||||
|
|
|
@ -64,13 +64,9 @@ public:
|
||||||
FrameMain *frame;
|
FrameMain *frame;
|
||||||
Automation4::AutoloadScriptManager *global_scripts;
|
Automation4::AutoloadScriptManager *global_scripts;
|
||||||
|
|
||||||
static wxString fullPath;
|
|
||||||
static wxString folderName;
|
|
||||||
static AegisubApp* Get() { return (AegisubApp*) wxTheApp; }
|
static AegisubApp* Get() { return (AegisubApp*) wxTheApp; }
|
||||||
static void OpenURL(wxString url);
|
static void OpenURL(wxString url);
|
||||||
|
|
||||||
void GetFullPath(wxString arg);
|
|
||||||
void GetFolderName();
|
|
||||||
void RegistryAssociate();
|
void RegistryAssociate();
|
||||||
void AssociateType(wxString type);
|
void AssociateType(wxString type);
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,6 @@
|
||||||
#include <wx/intl.h>
|
#include <wx/intl.h>
|
||||||
#include <wx/settings.h>
|
#include <wx/settings.h>
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "main.h"
|
|
||||||
#include "text_file_reader.h"
|
#include "text_file_reader.h"
|
||||||
#include "text_file_writer.h"
|
#include "text_file_writer.h"
|
||||||
#include "colorspace.h"
|
#include "colorspace.h"
|
||||||
|
@ -190,10 +189,9 @@ void OptionsManager::LoadDefaults(bool onlyDefaults) {
|
||||||
// Automation
|
// Automation
|
||||||
// The path changes only take effect when a script is (re)loaded but Automatic should be good enough, it certainly doesn't warrart a restart
|
// The path changes only take effect when a script is (re)loaded but Automatic should be good enough, it certainly doesn't warrart a restart
|
||||||
SetModificationType(MOD_AUTOMATIC);
|
SetModificationType(MOD_AUTOMATIC);
|
||||||
// TODO: these paths should be different on non-Windows systems
|
SetText(_T("Automation Base Path"), _T("?data/automation/"));
|
||||||
SetText(_T("Automation Base Path"), AegisubApp::folderName + _T("automation/"));
|
SetText(_T("Automation Include Path"), _T("?user/automation/include/|?data/automation/include/"));
|
||||||
SetText(_T("Automation Include Path"), AegisubApp::folderName + _T("automation/include/"));
|
SetText(_T("Automation Autoload Path"), _T("?user/automation/autoload/|?data/automation/include/"));
|
||||||
SetText(_T("Automation Autoload Path"), AegisubApp::folderName + _T("automation/autoload/"));
|
|
||||||
SetInt(_T("Automation Trace Level"), 3);
|
SetInt(_T("Automation Trace Level"), 3);
|
||||||
SetInt(_T("Automation Thread Priority"), 1); // "below normal"
|
SetInt(_T("Automation Thread Priority"), 1); // "below normal"
|
||||||
SetInt(_T("Automation Autoreload Mode"), 0); // never
|
SetInt(_T("Automation Autoreload Mode"), 0); // never
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
///////////
|
///////////
|
||||||
// Headers
|
// Headers
|
||||||
#include "spellchecker.h"
|
#include "spellchecker.h"
|
||||||
#include "main.h"
|
#include "standard_paths.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include <hunspell/hunspell.hxx>
|
#include <hunspell/hunspell.hxx>
|
||||||
|
@ -228,7 +228,7 @@ wxArrayString HunspellSpellChecker::GetSuggestions(wxString word) {
|
||||||
// Get list of available dictionaries
|
// Get list of available dictionaries
|
||||||
wxArrayString HunspellSpellChecker::GetLanguageList() {
|
wxArrayString HunspellSpellChecker::GetLanguageList() {
|
||||||
// Get dir name
|
// Get dir name
|
||||||
wxString path = DecodeRelativePath(Options.AsText(_T("Dictionaries path")),AegisubApp::folderName) + _T("/");
|
wxString path = DecodeRelativePath(Options.AsText(_T("Dictionaries path")),StandardPaths::DecodePath(_T("?data/"))) + _T("/");
|
||||||
wxArrayString list;
|
wxArrayString list;
|
||||||
wxFileName folder(path);
|
wxFileName folder(path);
|
||||||
if (!folder.DirExists()) return list;
|
if (!folder.DirExists()) return list;
|
||||||
|
@ -265,7 +265,7 @@ void HunspellSpellChecker::SetLanguage(wxString language) {
|
||||||
if (language.IsEmpty()) return;
|
if (language.IsEmpty()) return;
|
||||||
|
|
||||||
// Get dir name
|
// Get dir name
|
||||||
wxString path = DecodeRelativePath(Options.AsText(_T("Dictionaries path")),AegisubApp::folderName) + _T("/");
|
wxString path = DecodeRelativePath(Options.AsText(_T("Dictionaries path")),StandardPaths::DecodePath(_T("?data/"))) + _T("/");
|
||||||
|
|
||||||
// Get affix and dictionary paths
|
// Get affix and dictionary paths
|
||||||
affpath = path + language + _T(".aff");
|
affpath = path + language + _T(".aff");
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
#include <wx/filename.h>
|
#include <wx/filename.h>
|
||||||
#include "thesaurus_myspell.h"
|
#include "thesaurus_myspell.h"
|
||||||
#include "mythes.hxx"
|
#include "mythes.hxx"
|
||||||
#include "main.h"
|
#include "standard_paths.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ void MySpellThesaurus::Lookup(wxString word,ThesaurusEntryArray &result) {
|
||||||
// Get language list
|
// Get language list
|
||||||
wxArrayString MySpellThesaurus::GetLanguageList() {
|
wxArrayString MySpellThesaurus::GetLanguageList() {
|
||||||
// Get dir name
|
// Get dir name
|
||||||
wxString path = DecodeRelativePath(Options.AsText(_T("Dictionaries path")),AegisubApp::folderName) + _T("/");
|
wxString path = DecodeRelativePath(Options.AsText(_T("Dictionaries path")),StandardPaths::DecodePath(_T("?data/"))) + _T("/");
|
||||||
wxArrayString list;
|
wxArrayString list;
|
||||||
wxFileName folder(path);
|
wxFileName folder(path);
|
||||||
if (!folder.DirExists()) return list;
|
if (!folder.DirExists()) return list;
|
||||||
|
@ -138,7 +138,7 @@ void MySpellThesaurus::SetLanguage(wxString language) {
|
||||||
if (language.IsEmpty()) return;
|
if (language.IsEmpty()) return;
|
||||||
|
|
||||||
// Get dir name
|
// Get dir name
|
||||||
wxString path = DecodeRelativePath(Options.AsText(_T("Dictionaries path")),AegisubApp::folderName) + _T("/");
|
wxString path = DecodeRelativePath(Options.AsText(_T("Dictionaries path")),StandardPaths::DecodePath(_T("?data/"))) + _T("/");
|
||||||
|
|
||||||
// Get affix and dictionary paths
|
// Get affix and dictionary paths
|
||||||
wxString idxpath = path + _T("th_") + language + _T(".idx");
|
wxString idxpath = path + _T("th_") + language + _T(".idx");
|
||||||
|
|
|
@ -65,7 +65,6 @@
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "subs_edit_box.h"
|
#include "subs_edit_box.h"
|
||||||
#include "audio_display.h"
|
#include "audio_display.h"
|
||||||
#include "main.h"
|
|
||||||
#include "video_slider.h"
|
#include "video_slider.h"
|
||||||
#include "video_box.h"
|
#include "video_box.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
@ -591,17 +590,10 @@ void VideoContext::SaveSnapshot(bool raw) {
|
||||||
wxString option = Options.AsText(_("Video Screenshot Path"));
|
wxString option = Options.AsText(_("Video Screenshot Path"));
|
||||||
wxFileName videoFile(videoName);
|
wxFileName videoFile(videoName);
|
||||||
wxString basepath;
|
wxString basepath;
|
||||||
if (option == _T("?video")) {
|
if (option[0] == _T('?')) {
|
||||||
basepath = videoFile.GetPath();
|
basepath = StandardPaths::DecodePath(option);
|
||||||
}
|
}
|
||||||
else if (option == _T("?script")) {
|
else basepath = DecodeRelativePath(option,StandardPaths::DecodePath(_T("?user/")));
|
||||||
if (grid->ass->filename.IsEmpty()) basepath = videoFile.GetPath();
|
|
||||||
else {
|
|
||||||
wxFileName file2(grid->ass->filename);
|
|
||||||
basepath = file2.GetPath();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else basepath = DecodeRelativePath(option,((AegisubApp*)wxTheApp)->folderName);
|
|
||||||
basepath += _T("/") + videoFile.GetName();
|
basepath += _T("/") + videoFile.GetName();
|
||||||
|
|
||||||
// Get full path
|
// Get full path
|
||||||
|
|
|
@ -46,7 +46,7 @@
|
||||||
#include "subtitles_provider.h"
|
#include "subtitles_provider.h"
|
||||||
#include "video_context.h"
|
#include "video_context.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "main.h"
|
#include "standard_paths.h"
|
||||||
#include "vfr.h"
|
#include "vfr.h"
|
||||||
#include "ass_file.h"
|
#include "ass_file.h"
|
||||||
#include "gl_wrap.h"
|
#include "gl_wrap.h"
|
||||||
|
@ -231,7 +231,7 @@ PClip AvisynthVideoProvider::OpenVideo(wxString _filename, bool mpeg2dec3_priori
|
||||||
bool ffsource = false;
|
bool ffsource = false;
|
||||||
if (env->FunctionExists("ffmpegsource")) ffsource = true;
|
if (env->FunctionExists("ffmpegsource")) ffsource = true;
|
||||||
if (!ffsource) {
|
if (!ffsource) {
|
||||||
wxFileName ffsourcepath(AegisubApp::folderName + _T("ffmpegsource.dll"));
|
wxFileName ffsourcepath(StandardPaths::DecodePath(_T("?data/ffmpegsource.dll")));
|
||||||
if (ffsourcepath.FileExists()) {
|
if (ffsourcepath.FileExists()) {
|
||||||
AVSTRACE(_T("AvisynthVideoProvider::OpenVideo: Loading FFMpegSource"));
|
AVSTRACE(_T("AvisynthVideoProvider::OpenVideo: Loading FFMpegSource"));
|
||||||
env->Invoke("LoadPlugin",env->SaveString(ffsourcepath.GetFullPath().mb_str(wxConvLocal)));
|
env->Invoke("LoadPlugin",env->SaveString(ffsourcepath.GetFullPath().mb_str(wxConvLocal)));
|
||||||
|
@ -257,7 +257,7 @@ PClip AvisynthVideoProvider::OpenVideo(wxString _filename, bool mpeg2dec3_priori
|
||||||
bool dss2 = false;
|
bool dss2 = false;
|
||||||
if (env->FunctionExists("dss2")) dss2 = true;
|
if (env->FunctionExists("dss2")) dss2 = true;
|
||||||
if (!dss2) {
|
if (!dss2) {
|
||||||
wxFileName dss2path(AegisubApp::folderName + _T("avss.dll"));
|
wxFileName dss2path(StandardPaths::DecodePath(_T("?data/avss.dll")));
|
||||||
if (dss2path.FileExists()) {
|
if (dss2path.FileExists()) {
|
||||||
AVSTRACE(_T("AvisynthVideoProvider::OpenVideo: Loading DirectShowSource2"));
|
AVSTRACE(_T("AvisynthVideoProvider::OpenVideo: Loading DirectShowSource2"));
|
||||||
env->Invoke("LoadPlugin",env->SaveString(dss2path.GetFullPath().mb_str(wxConvLocal)));
|
env->Invoke("LoadPlugin",env->SaveString(dss2path.GetFullPath().mb_str(wxConvLocal)));
|
||||||
|
@ -480,7 +480,7 @@ void AvisynthVideoProvider::LoadVSFilter() {
|
||||||
AVSTRACE(_T("AvisynthVideoProvider::LoadVSFilter: Loading VSFilter"));
|
AVSTRACE(_T("AvisynthVideoProvider::LoadVSFilter: Loading VSFilter"));
|
||||||
// Loading an avisynth plugin multiple times does almost nothing
|
// Loading an avisynth plugin multiple times does almost nothing
|
||||||
|
|
||||||
wxFileName vsfilterPath(AegisubApp::folderName + _T("vsfilter.dll"));
|
wxFileName vsfilterPath(StandardPaths::DecodePath(_T("?data/vsfilter.dll")));
|
||||||
rendererCallString = _T("TextSub");
|
rendererCallString = _T("TextSub");
|
||||||
|
|
||||||
if (vsfilterPath.FileExists()) {
|
if (vsfilterPath.FileExists()) {
|
||||||
|
@ -525,7 +525,7 @@ void AvisynthVideoProvider::LoadASA() {
|
||||||
AVSTRACE(_T("AvisynthVideoProvider::LoadASA: Loading asa"));
|
AVSTRACE(_T("AvisynthVideoProvider::LoadASA: Loading asa"));
|
||||||
// Loading an avisynth plugin multiple times does almost nothing
|
// Loading an avisynth plugin multiple times does almost nothing
|
||||||
|
|
||||||
wxFileName asaPath(AegisubApp::folderName + _T("asa.dll"));
|
wxFileName asaPath(StandardPaths::DecodePath(_T("?data/asa.dll")));
|
||||||
rendererCallString = _T("asa");
|
rendererCallString = _T("asa");
|
||||||
|
|
||||||
if (asaPath.FileExists()) {
|
if (asaPath.FileExists()) {
|
||||||
|
|
Loading…
Reference in New Issue