Folder.pathname bug?


    Jan 16 2009 | 6:21 am
    It appears that Folder.pathname outputs both dir and file, making it same as this.patcher.filepath. Could this be a bug in Max5 (5.0.5 (36470) on WinXP; haven't tried yet OSX)?
    Try:
    function bang() { var p = this.patcher;
    //the following is absolute path + filename as expected post("filepath = " + p.filepath + "n");
    var f = new Folder(p.filepath);
    //now the following is the same as p.filepath but... //judging from its name it should be only the path, no? post("pathname = " + f.pathname + "n");
    //so to get the path one has to do the following: var tmp = p.filepath; var n = tmp.lastIndexOf('/'); var dir = tmp.substring(0,n+1); post("pathname = " + dir + "n"); }
    Any ideas?
    Ivica Ico Bukvic, D.M.A. Composition, Music Technology Director, DISIS Interactive Sound & Intermedia Studio Assistant Co-Director, CCTAD CHCI, CS, and Art (by courtesy) Virginia Tech Dept. of Music - 0240 Blacksburg, VA 24061 (540) 231-6139 (540) 231-5034 (fax) ico@vt.edu http://www.music.vt.edu/faculty/bukvic/

    • Jan 18 2009 | 11:59 pm
      Just to confirm the same is the case on OSX, so it may not be a bug after all. Yet, the "path" method available in the thispatcher object appears to be inaccessible for this.patcher. So apparently the only way to get to the directory (minus the filename) is the script below. Seems kinda redundant to have no way to getting a directory by itself while having two different ways of getting both folder and file, no?
      Ico
      > -----Original Message----- > From: javascript-dev-bounces@cycling74.com [mailto:javascript-dev- > bounces@cycling74.com] On Behalf Of Ivica Ico Bukvic > Sent: Friday, January 16, 2009 1:21 AM > Subject: [javascript-dev] Folder.pathname bug? > > It appears that Folder.pathname outputs both dir and file, making it same > as > this.patcher.filepath. Could this be a bug in Max5 (5.0.5 (36470) on > WinXP; > haven't tried yet OSX)? > > Try: > > function bang() { > var p = this.patcher; > > //the following is absolute path + filename as expected > post("filepath = " + p.filepath + "n"); > > var f = new Folder(p.filepath); > > //now the following is the same as p.filepath but... > //judging from its name it should be only the path, no? > post("pathname = " + f.pathname + "n"); > > //so to get the path one has to do the following: > var tmp = p.filepath; > var n = tmp.lastIndexOf('/'); > var dir = tmp.substring(0,n+1); > post("pathname = " + dir + "n"); > } > > Any ideas? > > Ivica Ico Bukvic, D.M.A. > Composition, Music Technology > Director, DISIS Interactive Sound & Intermedia Studio > Assistant Co-Director, CCTAD > CHCI, CS, and Art (by courtesy) > Virginia Tech > Dept. of Music - 0240 > Blacksburg, VA 24061 > (540) 231-6139 > (540) 231-5034 (fax) > ico@vt.edu > http://www.music.vt.edu/faculty/bukvic/ > >