Skip to content

Commit

Permalink
playlist: fix drag'n'drop for windows
Browse files Browse the repository at this point in the history
  • Loading branch information
kuba160 committed Apr 30, 2018
1 parent 13ae789 commit a32c4e1
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions playlist.c
Original file line number Diff line number Diff line change
Expand Up @@ -962,6 +962,16 @@ plt_insert_file_int (int visibility, playlist_t *playlist, playItem_t *after, co
}
eol++;

// WINDOWS FIX: gtkui will call this function with file path starting with '/' (possibly indicating 'root' directory)
// example: "file:///E:/test.flac" -> "/E:/test.flac"
// in comparsion to linux systems, decoders on windows don't like this string starting with '/'
// we remove it here and hopefully we do not break anything
#ifdef __MINGW32__
if (fname[0] == '/') {
fname++;
}
#endif

// handle cue files
if (!strcasecmp (eol, "cue")) {
playItem_t *inserted = plt_load_cue_file(playlist, after, fname, NULL, NULL, 0);
Expand Down Expand Up @@ -1121,6 +1131,16 @@ plt_insert_dir_int (int visibility, playlist_t *playlist, DB_vfs_t *vfs, playIte
dirname += 7;
}

// WINDOWS FIX: gtkui will call this function with file path starting with '/' (possibly indicating 'root' directory)
// example: "file:///E:/test.flac" -> "/E:/test.flac"
// in comparsion to linux systems, decoders on windows don't like this string starting with '/'
// we remove it here and hopefully we do not break anything
#ifdef __MINGW32__
if (dirname[0] == '/') {
dirname++;
}
#endif

if (!playlist->follow_symlinks && !vfs) {
struct stat buf;
lstat (dirname, &buf);
Expand Down

0 comments on commit a32c4e1

Please sign in to comment.