You've already forked libopenshot
mirror of
https://github.com/OpenShot/libopenshot.git
synced 2026-03-02 08:53:52 -08:00
Fixing unicode path issues when loading a Profile() class. Broke when using unicode home directory on Windows.
This commit is contained in:
@@ -34,6 +34,8 @@
|
||||
#include <fstream>
|
||||
#include <QtCore/qstring.h>
|
||||
#include <QtCore/qstringlist.h>
|
||||
#include <QtCore/qfile.h>
|
||||
#include <QTextStream>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "Exceptions.h"
|
||||
|
||||
@@ -51,24 +51,19 @@ Profile::Profile(string path) throw(InvalidFile, InvalidJSON) {
|
||||
info.display_ratio.den = 0;
|
||||
info.interlaced_frame = false;
|
||||
|
||||
// Read the profile file
|
||||
ifstream myfile (path.c_str());
|
||||
if (myfile.is_open())
|
||||
QFile inputFile(path.c_str());
|
||||
if (inputFile.open(QIODevice::ReadOnly))
|
||||
{
|
||||
// Loop through each line
|
||||
while (myfile.good())
|
||||
QTextStream in(&inputFile);
|
||||
while (!in.atEnd())
|
||||
{
|
||||
// read current line of file
|
||||
read_file = true;
|
||||
string line = "";
|
||||
getline (myfile, line);
|
||||
QString line = in.readLine();
|
||||
|
||||
if (line.length() <= 0)
|
||||
continue;
|
||||
|
||||
// Split current line
|
||||
QString qline(line.c_str());
|
||||
QStringList parts = qline.split( "=" );
|
||||
QStringList parts = line.split( "=" );
|
||||
string setting = parts[0].toStdString();
|
||||
string value = parts[1].toStdString();
|
||||
int value_int = 0;
|
||||
@@ -117,7 +112,8 @@ Profile::Profile(string path) throw(InvalidFile, InvalidJSON) {
|
||||
info.pixel_format = value_int;
|
||||
}
|
||||
}
|
||||
myfile.close();
|
||||
read_file = true;
|
||||
inputFile.close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user