use mkdir() instead of system() + a few clean-ups

This commit is contained in:
unK
2008-09-04 01:03:29 +02:00
parent d7b635e276
commit c2225172fb
5 changed files with 15 additions and 15 deletions

View File

@@ -19,9 +19,9 @@
***************************************************************************/
#include "lyrics.h"
#include <fcntl.h>
const string lyrics_folder = home_folder + "/" + ".lyrics";
const string mkdir_command = "mkdir " + lyrics_folder + " &>/dev/null";
size_t write_data(char *buffer, size_t size, size_t nmemb, string data)
{
@@ -38,7 +38,7 @@ string GetLyrics(string artist, string song)
{
const string filename = artist + " - " + song + ".txt";
const string fullpath = lyrics_folder + "/" + filename;
system(mkdir_command.c_str());
mkdir(lyrics_folder.c_str(), 0755);
string result;
std::ifstream input(fullpath.c_str());