Skip to content

Commit

Permalink
keep line break when reading file with FileIO, add support for file:/…
Browse files Browse the repository at this point in the history
…/ url in FileIO
  • Loading branch information
lasconic committed Jul 23, 2013
1 parent c05df37 commit cc2a98c
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions mscore/plugins.cpp
Expand Up @@ -434,15 +434,19 @@ QString FileIO::read()
emit error("source is empty");
return QString();
}

QFile file(mSource);
QUrl url(mSource);
QString source(mSource);
if(url.isValid() && url.isLocalFile()) {
source = url.toLocalFile();
}
QFile file(source);
QString fileContent;
if ( file.open(QIODevice::ReadOnly) ) {
QString line;
QTextStream t( &file );
do {
line = t.readLine();
fileContent += line;
fileContent += line + "\n";
} while (!line.isNull());
file.close();
}
Expand Down

0 comments on commit cc2a98c

Please sign in to comment.