Remove StandardPaths::DecodePathMaybeRelative, as it's been deprecated forever

Originally committed to SVN as r6232.
This commit is contained in:
Thomas Goyne 2012-01-08 01:34:37 +00:00
parent 15d49fb655
commit 01646d7cf4
4 changed files with 8 additions and 71 deletions

View File

@ -128,19 +128,13 @@ void AssFile::Load(const wxString &_filename,wxString charset,bool addToRecent)
if (file.FileExists()) {
wxString path = lagi_wxString(OPT_GET("Path/Auto/Backup")->GetString());
if (path.empty()) path = file.GetPath();
wxFileName dstpath(StandardPaths::DecodePath(path));
if (!dstpath.DirExists())
wxMkdir(dstpath.GetPath());
wxFileName dstpath(path);
if (!dstpath.IsAbsolute())
path = StandardPaths::DecodePathMaybeRelative(path, "?user/");
path += "/";
dstpath.Assign(path);
dstpath.SetFullName(file.GetName() + ".ORIGINAL." + file.GetExt());
if (!dstpath.DirExists()) {
wxMkdir(path);
}
wxString backup = path + file.GetName() + ".ORIGINAL." + file.GetExt();
wxCopyFile(file.GetFullPath(), backup, true);
wxCopyFile(file.GetFullPath(), dstpath.GetFullPath(), true);
}
}
@ -190,11 +184,9 @@ wxString AssFile::AutoSave() {
wxString path = lagi_wxString(OPT_GET("Path/Auto/Save")->GetString());
if (!path)
path = origfile.GetPath();
path = StandardPaths::DecodePath(path);
wxFileName dstpath(path);
if (!dstpath.IsAbsolute())
path = StandardPaths::DecodePathMaybeRelative(path, "?user/");
dstpath.AssignDir(path);
if (!dstpath.DirExists())
wxMkdir(path);

View File

@ -79,10 +79,10 @@ public:
};
static void browse_button(wxTextCtrl *ctrl) {
wxString def = StandardPaths::DecodePathMaybeRelative(ctrl->GetValue(), "?user/");
wxString def = StandardPaths::DecodePath(ctrl->GetValue());
wxDirDialog dlg(0, _("Please choose the folder:"), def);
if (dlg.ShowModal() == wxID_OK) {
wxString dir = StandardPaths::EncodePath(dlg.GetPath());
wxString dir = dlg.GetPath();
if (!dir.empty())
ctrl->SetValue(dir);
}

View File

@ -125,19 +125,6 @@ wxString StandardPaths::DoDecodePath(wxString path) {
else return path;
}
/// @brief Encode path
/// @param path
/// @return
///
wxString StandardPaths::DoEncodePath(const wxString &path) {
// TODO
return path;
}
/// @brief Set value of a ? path
/// @param path
/// @param value
@ -145,19 +132,3 @@ wxString StandardPaths::DoEncodePath(const wxString &path) {
void StandardPaths::DoSetPathValue(const wxString &path, const wxString &value) {
paths[path] = value;
}
/// @brief Decode a path that for legacy reasons might be relative to another path
/// @param path parent path.
/// @param relativeTo relative path.
/// @returns absolute path
/// @depreciated Older aegisub versions allowed people to put in single directory names w/out a full path this isn't an issue with 2.2 as preferences will be redone.
wxString StandardPaths::DecodePathMaybeRelative(const wxString &path, const wxString &relativeTo) {
wxFileName res(DecodePath(path));
if (res.IsRelative())
res.Assign(DecodePath(relativeTo + "/" + path));
return res.GetFullPath();
}

View File

@ -34,11 +34,6 @@
/// @ingroup utility
///
///////////
// Headers
#ifndef AGI_PRE
#include <map>
#endif
@ -50,10 +45,8 @@
///
/// DOCME
class StandardPaths {
private:
static StandardPaths &GetInstance();
/// DOCME
std::map<wxString,wxString> paths;
@ -62,29 +55,10 @@ private:
StandardPaths& operator=(StandardPaths const&);
wxString DoDecodePath(wxString path);
wxString DoEncodePath(const wxString &path);
void DoSetPathValue(const wxString &path, const wxString &value);
public:
/// @brief DOCME
/// @param path
/// @return
///
static wxString DecodePath(const wxString &path) { return GetInstance().DoDecodePath(path); }
static wxString DecodePathMaybeRelative(const wxString &path, const wxString &relativeTo);
/// @brief DOCME
/// @param path
/// @return
///
static wxString EncodePath(const wxString &path) { return GetInstance().DoEncodePath(path); }
/// @brief DOCME
/// @param path
/// @param value
///
static void SetPathValue(const wxString &path, const wxString &value) { GetInstance().DoSetPathValue(path,value); }
};