Skip to content

StringVariable's ToFile - Relax File extension and path#3212

Merged
Ghabry merged 1 commit into
EasyRPG:masterfrom
EasyRPG-NewFeatures:jetrotal---Relax-StringVars-ToFile
May 9, 2024
Merged

StringVariable's ToFile - Relax File extension and path#3212
Ghabry merged 1 commit into
EasyRPG:masterfrom
EasyRPG-NewFeatures:jetrotal---Relax-StringVars-ToFile

Conversation

@jetrotal

@jetrotal jetrotal commented Apr 20, 2024

Copy link
Copy Markdown
Contributor

When saving a file, maniacs forces the File in Text/ folder with .txt extension.
Through this PR, if '*' is at the end of filename, the file extension is relaxed.

@jetrotal jetrotal force-pushed the jetrotal---Relax-StringVars-ToFile branch from a836f71 to 99379cc Compare April 20, 2024 21:05
@carstene1ns

Copy link
Copy Markdown
Member

Does this open an issue with path traversal: ../../../some/file?

@jetrotal

Copy link
Copy Markdown
Contributor Author

I guess not, the default behavior allows leaving the /text/file.txt by using ../charset/file.txt as a file name.

my code, simply moves the text file from /text/ to the root of the game whenver the filename ends with *

@Ghabry

Ghabry commented Apr 20, 2024

Copy link
Copy Markdown
Member

In an ideal world where Maniac Patch and TPC are open source and not obfuscated I would suggest to add a new flag to indicate "absolute path". End of rant


This is a bit opinionated but I do not like the *. The typical convention for an absolute path is to prefix it with /. You should be even able to forward such a path directly to OpenOutputStream without removing the slash manually.

Can you add a comment that this is an EasyRPG Extension?

(Also please remove trivial comments like // Remove the last character. Makes the code look less ChatGPT-generated.)

@jetrotal jetrotal force-pushed the jetrotal---Relax-StringVars-ToFile branch 2 times, most recently from 731f1ef to 57c15fc Compare April 20, 2024 23:09
Comment thread src/game_strings.cpp Outdated
@Ghabry Ghabry added this to the 0.8.1 milestone Apr 20, 2024
@jetrotal jetrotal force-pushed the jetrotal---Relax-StringVars-ToFile branch from b5730fb to b69bdd8 Compare April 20, 2024 23:28
@Ghabry Ghabry added the EasyRPG New functionality exclusive to EasyRPG Player label Apr 20, 2024
When saving a file, maniacs forces the File in Text/ folder with .txt extension.
Through this PR, if '*' is at the end of filename, the file extension is relaxed.

It also better handles the creation of nested directories.
@Ghabry Ghabry force-pushed the jetrotal---Relax-StringVars-ToFile branch from b69bdd8 to d516336 Compare May 9, 2024 20:45
@Ghabry Ghabry merged commit 2721218 into EasyRPG:master May 9, 2024
@jetrotal jetrotal deleted the jetrotal---Relax-StringVars-ToFile branch August 4, 2024 23:34
sevenc-nanashi pushed a commit to sevenc-nanashi/easyrpg-player that referenced this pull request May 31, 2026
…elax-StringVars-ToFile

StringVariable's ToFile - Relax File extension and path
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

EasyRPG New functionality exclusive to EasyRPG Player

Development

Successfully merging this pull request may close these issues.

3 participants