diff --git a/taglib/it/itfile.cpp b/taglib/it/itfile.cpp index b5e12cb4..3f65cd7c 100644 --- a/taglib/it/itfile.cpp +++ b/taglib/it/itfile.cpp @@ -21,6 +21,7 @@ #include "tstringlist.h" #include "itfile.h" +#include "tdebug.h" #include "modfileprivate.h" using namespace TagLib; @@ -76,6 +77,11 @@ IT::Properties *IT::File::audioProperties() const bool IT::File::save() { + if(readOnly()) + { + debug("IT::File::save() - Cannot save to a read only file."); + return false; + } seek(4); writeString(d->tag.title(), 26); // TODO: write comment as instrument and sample names diff --git a/taglib/mod/modfile.cpp b/taglib/mod/modfile.cpp index 669db096..32215337 100644 --- a/taglib/mod/modfile.cpp +++ b/taglib/mod/modfile.cpp @@ -21,6 +21,7 @@ #include "modfile.h" #include "tstringlist.h" +#include "tdebug.h" #include "modfileprivate.h" using namespace TagLib; @@ -71,6 +72,11 @@ Mod::Properties *Mod::File::audioProperties() const bool Mod::File::save() { + if(readOnly()) + { + debug("Mod::File::save() - Cannot save to a read only file."); + return false; + } seek(0); writeString(d->tag.title(), 20, ' '); // TODO: write comment as instrument names diff --git a/taglib/s3m/s3mfile.cpp b/taglib/s3m/s3mfile.cpp index c0d4b241..45556cc6 100644 --- a/taglib/s3m/s3mfile.cpp +++ b/taglib/s3m/s3mfile.cpp @@ -21,6 +21,7 @@ #include "s3mfile.h" #include "tstringlist.h" +#include "tdebug.h" #include "modfileprivate.h" using namespace TagLib; @@ -71,6 +72,11 @@ S3M::Properties *S3M::File::audioProperties() const bool S3M::File::save() { + if(readOnly()) + { + debug("S3M::File::save() - Cannot save to a read only file."); + return false; + } // note: if title starts with "Extended Module: " // the file would look like an .xm file seek(0); diff --git a/taglib/xm/xmfile.cpp b/taglib/xm/xmfile.cpp index ed5e07ec..57b6be7b 100644 --- a/taglib/xm/xmfile.cpp +++ b/taglib/xm/xmfile.cpp @@ -20,6 +20,7 @@ ***************************************************************************/ #include "tstringlist.h" +#include "tdebug.h" #include "xmfile.h" #include "modfileprivate.h" @@ -73,6 +74,11 @@ XM::Properties *XM::File::audioProperties() const bool XM::File::save() { + if(readOnly()) + { + debug("XM::File::save() - Cannot save to a read only file."); + return false; + } seek(17); writeString(d->tag.title(), 20); seek(1, Current);