Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Canonical Paths for Relative Paths Calculations #4211

Merged
merged 3 commits into from Mar 4, 2018

Conversation

tresf
Copy link
Member

@tresf tresf commented Mar 3, 2018

Forces strange paths like /path/.///to/../from/foo///// to be /path/from/foo.

Closes #4173

@@ -40,8 +40,10 @@ private slots:

QString absPath = fi.absoluteFilePath();
QString relPath = "drums/kick01.ogg";
QString fuzPath = absPath.replace(relPath, "drums/.///kick01.ogg");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Current one won't work because this line modifies absPath. This one will work:

QString fuzPath = absPath;
fuzPath.replace(relPath, "drums/.///kick01.ogg");

Copy link
Member Author

@tresf tresf Mar 4, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes, forgot Strings are mutable in Qt. Thanks.

QString are mutable objects.  Call replace on the clone, not on the original.
@tresf tresf merged commit 1d63bd3 into LMMS:stable-1.2 Mar 4, 2018
@tresf tresf deleted the relative branch March 4, 2018 03:46
@tresf tresf restored the relative branch March 22, 2018 16:52
sdasda7777 pushed a commit to sdasda7777/lmms that referenced this pull request Jun 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants