- fix: file path seperator used in the app is not unified, and cause errors somtimes.

This commit is contained in:
royqh1979 2021-10-23 19:27:50 +08:00
parent c3be38b9b6
commit aebcce0b05
2 changed files with 7 additions and 5 deletions

View File

@ -23,7 +23,7 @@ Project::Project(const QString &filename, const QString &name, QObject *parent)
QObject(parent),
mModel(this)
{
mFilename = filename;
mFilename = QFileInfo(filename).absoluteFilePath();
mParser = std::make_shared<CppParser>();
mParser->setOnGetFileStream(
std::bind(
@ -170,8 +170,9 @@ void Project::open()
rebuildNodes();
}
void Project::setFileName(const QString &value)
void Project::setFileName(QString value)
{
value = QFileInfo(value).absoluteFilePath();
if (mFilename!=value) {
QFile::rename(mFilename,value);
mFilename = value;
@ -1579,8 +1580,9 @@ const QString &ProjectUnit::fileName() const
return mFileName;
}
void ProjectUnit::setFileName(const QString &newFileName)
void ProjectUnit::setFileName(QString newFileName)
{
newFileName = QFileInfo(newFileName).absoluteFilePath();
if (mFileName != newFileName) {
mFileName = newFileName;
if (mNode) {

View File

@ -31,7 +31,7 @@ public:
Editor *editor() const;
void setEditor(Editor *newEditor);
const QString &fileName() const;
void setFileName(const QString &newFileName);
void setFileName(QString newFileName);
bool isNew() const;
void setNew(bool newNew);
const QString &folder() const;
@ -109,7 +109,7 @@ public:
QString executable() const;
QString makeFileName();
bool modified() const;
void setFileName(const QString& value);
void setFileName(QString value);
void setModified(bool value);
void addFolder(const QString& s);