No longer try to automatically backup binary files (especially nasty when loading subs from mkv).
Originally committed to SVN as r1047.
This commit is contained in:
parent
be5c36bcab
commit
1c6bea3220
1 changed files with 3 additions and 1 deletions
|
@ -546,6 +546,7 @@ void FrameMain::LoadSubtitles (wxString filename,wxString charset) {
|
||||||
|
|
||||||
// Setup
|
// Setup
|
||||||
bool isFile = (filename != _T(""));
|
bool isFile = (filename != _T(""));
|
||||||
|
bool isBinary = false;
|
||||||
|
|
||||||
// Load
|
// Load
|
||||||
try {
|
try {
|
||||||
|
@ -556,6 +557,7 @@ void FrameMain::LoadSubtitles (wxString filename,wxString charset) {
|
||||||
|
|
||||||
// Make sure that file isn't actually a timecode file
|
// Make sure that file isn't actually a timecode file
|
||||||
TextFileReader testSubs(filename);
|
TextFileReader testSubs(filename);
|
||||||
|
isBinary = testSubs.GetCurrentEncoding() == _T("binary");
|
||||||
if (testSubs.HasMoreLines()) {
|
if (testSubs.HasMoreLines()) {
|
||||||
wxString cur = testSubs.ReadLineFromFile();
|
wxString cur = testSubs.ReadLineFromFile();
|
||||||
if (cur.Left(10) == _T("# timecode")) {
|
if (cur.Left(10) == _T("# timecode")) {
|
||||||
|
@ -587,7 +589,7 @@ void FrameMain::LoadSubtitles (wxString filename,wxString charset) {
|
||||||
|
|
||||||
// Save copy
|
// Save copy
|
||||||
wxFileName origfile(filename);
|
wxFileName origfile(filename);
|
||||||
if (Options.AsBool(_T("Auto backup")) && origfile.FileExists()) {
|
if (!isBinary && Options.AsBool(_T("Auto backup")) && origfile.FileExists()) {
|
||||||
// Get path
|
// Get path
|
||||||
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();
|
||||||
|
|
Loading…
Reference in a new issue