Page Menu
Home
Phabricator (Chris)
Search
Configure Global Search
Log In
Files
F628284
Update-Score-Filenames-for-Better-.config-integration
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
Update-Score-Filenames-for-Better-.config-integration
View Options
Description: Make score textfile name distinct
Rename scores.txt because it could have a namespace collision
with something else that uses XDG standard but then calls its
config file "scores.txt".
Forwarded: not-needed
Last-Update: 2020-08-07
--- darthinvaders-1.0.orig/Test.cpp
+++ darthinvaders-1.0/Test.cpp
@@ -121,9 +121,9 @@ int main(void)
// if scores file is not user's dir, copy it in.
// it'll still degrade gracefully if you can't write here
// Filesystem standard says to put highscores in /var/games but then new users have no write perms??
- std::string path = confdir + "/scores.txt";
+ std::string path = confdir + "/darthinvaders-scores.txt";
if (access (confdir.c_str(), F_OK) == 0 && access(path.c_str(), F_OK) != 0 && access (confdir.c_str(), W_OK) == 0) {
- ifstream source("scores.txt", ios::binary);
+ ifstream source("darthinvaders-scores.txt", ios::binary);
ofstream dest(path, ios::binary);
dest << source.rdbuf();
@@ -987,7 +987,7 @@ void DrawAnimation(ALLEGRO_BITMAP *pic,
void readScores()
{
- ifstream myfile(confdir+"scores.txt");
+ ifstream myfile(confdir+"darthinvaders-scores.txt");
string line;
Highscores temp;
int count = 0;
@@ -1021,7 +1021,7 @@ void writeScore()
arrScores[pos + 1].score = score;
arrScores[pos + 1].name = nameString;
- ofstream OutputFile(confdir+"scores.txt");
+ ofstream OutputFile(confdir+"darthinvaders-scores.txt");
for (i = 0; i < 9; i++)
{
if (arrScores[i].name == "")
--- /dev/null
+++ darthinvaders-1.0/darthinvaders-scores.txt
@@ -0,0 +1,10 @@
+99999999 Vaid
+5320 jazz
+4870 mo
+4110 muhammad
+4020 dead
+1980 jazz
+1400 mo
+1320 mall
+1140 jazz
+730 mo
\ No newline at end of file
--- darthinvaders-1.0.orig/scores.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-99999999 Vaid
-5320 jazz
-4870 mo
-4110 muhammad
-4020 dead
-1980 jazz
-1400 mo
-1320 mall
-1140 jazz
-730 mo
\ No newline at end of file
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sun, Nov 15, 3:29 AM (1 d, 22 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
128371
Default Alt Text
Update-Score-Filenames-for-Better-.config-integration (1 KB)
Attached To
Mode
R72 DarthInvaders
Attached
Detach File
Event Timeline