mirror of
https://github.com/owntone/owntone-server.git
synced 2025-01-13 07:53:23 -05:00
Make windows slashed playlists work on unix (and vice versa)
This commit is contained in:
parent
b0f3a6efb9
commit
a9cb506963
@ -463,6 +463,8 @@ int main(int argc, char *argv[]) {
|
|||||||
DPRINTF(E_LOG,L_MAIN,"Scanned %d songs in %d seconds\n",song_count,
|
DPRINTF(E_LOG,L_MAIN,"Scanned %d songs in %d seconds\n",song_count,
|
||||||
end_time-start_time);
|
end_time-start_time);
|
||||||
|
|
||||||
|
config.reload = 1; /* force a reload on start */
|
||||||
|
|
||||||
while(!config.stop) {
|
while(!config.stop) {
|
||||||
if((conf_get_int("general","rescan_interval",0) &&
|
if((conf_get_int("general","rescan_interval",0) &&
|
||||||
(rescan_counter > conf_get_int("general","rescan_interval",0)))) {
|
(rescan_counter > conf_get_int("general","rescan_interval",0)))) {
|
||||||
|
@ -397,6 +397,7 @@ int scan_static_playlist(char *path) {
|
|||||||
struct stat sb;
|
struct stat sb;
|
||||||
char *current;
|
char *current;
|
||||||
char *perr;
|
char *perr;
|
||||||
|
char *ptr;
|
||||||
|
|
||||||
DPRINTF(E_WARN,L_SCAN|L_PL,"Processing static playlist: %s\n",path);
|
DPRINTF(E_WARN,L_SCAN|L_PL,"Processing static playlist: %s\n",path);
|
||||||
if(stat(path,&sb)) {
|
if(stat(path,&sb)) {
|
||||||
@ -404,7 +405,8 @@ int scan_static_playlist(char *path) {
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if((current=strrchr(path,PATHSEP)) == NULL) {
|
if(((current=strrchr(path,'/')) == NULL) &&
|
||||||
|
((current=strrchr(path,'\\')) == NULL)) {
|
||||||
current = path;
|
current = path;
|
||||||
} else {
|
} else {
|
||||||
current++;
|
current++;
|
||||||
@ -442,7 +444,14 @@ int scan_static_playlist(char *path) {
|
|||||||
}
|
}
|
||||||
/* now get the *real* base_path */
|
/* now get the *real* base_path */
|
||||||
strcpy(base_path,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';
|
*(current+1) = '\x0';
|
||||||
} /* else something is fubar */
|
} /* else something is fubar */
|
||||||
|
|
||||||
@ -459,6 +468,13 @@ int scan_static_playlist(char *path) {
|
|||||||
|
|
||||||
// FIXME - should chomp trailing comments
|
// FIXME - should chomp trailing comments
|
||||||
|
|
||||||
|
ptr = linebuffer;
|
||||||
|
while(*ptr) {
|
||||||
|
if((*ptr == '/') || (*ptr == '\\'))
|
||||||
|
*ptr = PATHSEP;
|
||||||
|
ptr++;
|
||||||
|
}
|
||||||
|
|
||||||
// otherwise, assume it is a path
|
// otherwise, assume it is a path
|
||||||
if((linebuffer[0] == PATHSEP) || (linebuffer[1] == ':')) {
|
if((linebuffer[0] == PATHSEP) || (linebuffer[1] == ':')) {
|
||||||
strcpy(file_path,linebuffer);
|
strcpy(file_path,linebuffer);
|
||||||
|
Loading…
Reference in New Issue
Block a user