aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2012-08-21 01:08:40 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2012-08-21 01:08:40 +0200
commit1c31d1680eee883c4a0a737132803dc15405b6a7 (patch)
tree6d35a5ac4ecf76fab4acc0f4a713f0a4dbf968d8
parentDon't redeclare that variable. (diff)
downloadmusic-file-organizer-1c31d1680eee883c4a0a737132803dc15405b6a7.tar.xz
music-file-organizer-1c31d1680eee883c4a0a737132803dc15405b6a7.zip
Remove all trailing slashes.
-rw-r--r--organizemusic.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/organizemusic.cpp b/organizemusic.cpp
index b705091..e54af8c 100644
--- a/organizemusic.cpp
+++ b/organizemusic.cpp
@@ -275,8 +275,8 @@ int main(int argc, char *argv[])
base_destination.append("/");
} else if (char *home = getenv("HOME")) {
len = strlen(home);
- if (home[len - 1] == '/')
- home[len - 1] = '\0';
+ while (home[len - 1] == '/')
+ home[--len] = '\0';
base_destination = string(home) + "/Music/";
} else {
cerr << RED << "Fatal: Could not determine the music directory. Try setting the MUSICDIR or HOME environment variable." << RESET << endl;
@@ -286,8 +286,8 @@ int main(int argc, char *argv[])
/* Process all arguments to program as input paths. */
for (int i = 1; i < argc; ++i) {
len = strlen(argv[i]);
- if (argv[i][len - 1] == '/')
- argv[i][len - 1] = '\0';
+ while (argv[i][len - 1] == '/')
+ argv[i][--len] = '\0';
process_path(argv[i]);
}