From 3af81e63bfae3b7a3203de28fc8ae466a54212f0 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Mon, 28 Feb 2011 16:35:43 +0000 Subject: [PATCH] remove hard-coded use of '/' in pathscanner code as dir separator (use glib instead) git-svn-id: svn://localhost/ardour2/branches/3.0@8990 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/pbd/pathscanner.cc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/libs/pbd/pathscanner.cc b/libs/pbd/pathscanner.cc index 35182042d3..8f57726c7f 100644 --- a/libs/pbd/pathscanner.cc +++ b/libs/pbd/pathscanner.cc @@ -26,6 +26,8 @@ #include #include +#include + #include "pbd/error.h" #include "pbd/pathscanner.h" #include "pbd/stl_delete.h" @@ -90,7 +92,7 @@ PathScanner::run_scan_internal (vector *result, struct dirent *finfo; char *pathcopy = strdup (dirpath.c_str()); char *thisdir; - char fullpath[PATH_MAX+1]; + string fullpath; string search_str; string *newstr; long nfound = 0; @@ -117,12 +119,11 @@ PathScanner::run_scan_internal (vector *result, (finfo->d_name[0] == '.' && finfo->d_name[1] == '.' && finfo->d_name[2] == '\0')) { continue; } - - snprintf (fullpath, sizeof(fullpath), "%s/%s", - thisdir, finfo->d_name); + + fullpath = Glib::build_filename (thisdir, finfo->d_name); struct stat statbuf; - if (stat (fullpath, &statbuf) < 0) { + if (stat (fullpath.c_str(), &statbuf) < 0) { continue; } @@ -147,7 +148,7 @@ PathScanner::run_scan_internal (vector *result, continue; } } - + if (return_fullpath) { newstr = new string (fullpath); } else {