playlist: use g_file_test() instead of stat()

To find out whether a file exists, use g_file_test() instead of
stat(), because it is more portable and easier to use.
This commit is contained in:
Max Kellermann
2009-01-01 19:22:07 +01:00
parent 80fa9183e4
commit 0c422838a8
2 changed files with 3 additions and 6 deletions

View File

@@ -1202,14 +1202,13 @@ void shufflePlaylist(void)
enum playlist_result savePlaylist(const char *utf8file)
{
FILE *fp;
struct stat sb;
char *path;
if (!is_valid_playlist_name(utf8file))
return PLAYLIST_RESULT_BAD_NAME;
path = map_spl_utf8_to_fs(utf8file);
if (!stat(path, &sb)) {
if (g_file_test(path, G_FILE_TEST_EXISTS)) {
g_free(path);
return PLAYLIST_RESULT_LIST_EXISTS;
}