Make windows slashed playlists work on unix (and vice versa)

This commit is contained in:
Ron Pedde 2006-05-24 04:53:44 +00:00
parent b0f3a6efb9
commit a9cb506963
2 changed files with 20 additions and 2 deletions

View File

@ -463,6 +463,8 @@ int main(int argc, char *argv[]) {
DPRINTF(E_LOG,L_MAIN,"Scanned %d songs in %d seconds\n",song_count,
end_time-start_time);
config.reload = 1; /* force a reload on start */
while(!config.stop) {
if((conf_get_int("general","rescan_interval",0) &&
(rescan_counter > conf_get_int("general","rescan_interval",0)))) {

View File

@ -397,6 +397,7 @@ int scan_static_playlist(char *path) {
struct stat sb;
char *current;
char *perr;
char *ptr;
DPRINTF(E_WARN,L_SCAN|L_PL,"Processing static playlist: %s\n",path);
if(stat(path,&sb)) {
@ -404,7 +405,8 @@ int scan_static_playlist(char *path) {
return FALSE;
}
if((current=strrchr(path,PATHSEP)) == NULL) {
if(((current=strrchr(path,'/')) == NULL) &&
((current=strrchr(path,'\\')) == NULL)) {
current = path;
} else {
current++;
@ -442,7 +444,14 @@ int scan_static_playlist(char *path) {
}
/* now get the *real* base_path */
strcpy(base_path,path);
if((current=strrchr(base_path,PATHSEP))) {
ptr = base_path;
while(*ptr) {
if((*ptr == '/') || (*ptr == '\\'))
*ptr = PATHSEP;
ptr++;
}
if((current=strrchr(base_path,PATHSEP))){
*(current+1) = '\x0';
} /* else something is fubar */
@ -459,6 +468,13 @@ int scan_static_playlist(char *path) {
// FIXME - should chomp trailing comments
ptr = linebuffer;
while(*ptr) {
if((*ptr == '/') || (*ptr == '\\'))
*ptr = PATHSEP;
ptr++;
}
// otherwise, assume it is a path
if((linebuffer[0] == PATHSEP) || (linebuffer[1] == ':')) {
strcpy(file_path,linebuffer);