Skip to content

Commit

Permalink
Removed CRLF Writing Mode for Appinfo.tgc
Browse files Browse the repository at this point in the history
  • Loading branch information
TheSR committed Sep 28, 2024
1 parent 9408d72 commit 01d042d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ namespace Menu {
int lineCount = 0;

while (std::getline(infile, line)) {
// Remove any trailing '\r' characters if there is any
if (!line.empty() && line.back() == '\r') {
line.pop_back();
}

if (lineCount == 1) { // Replace the second line
content += selectedUrl + "\n";
} else {
Expand All @@ -105,7 +110,7 @@ namespace Menu {
}
infile.close();

std::ofstream outfile(filepath);
std::ofstream outfile(filepath, std::ios::out | std::ios::binary);
if (!outfile.is_open()) {
throw std::runtime_error("Could not open AppInfo file for writing: " + filepath);
}
Expand Down

0 comments on commit 01d042d

Please sign in to comment.