diff options
author | Hans-Christoph Steiner <eighthave@users.sourceforge.net> | 2011-08-15 20:37:18 +0000 |
---|---|---|
committer | IOhannes m zmölnig <zmoelnig@iem.at> | 2015-10-14 15:23:30 +0200 |
commit | 3b927068e4381015b819c20b723482c5ba677bd4 (patch) | |
tree | 71a1efa4370db72ba2bd3c5b72a777fabf2d78e0 | |
parent | 95bec78290ec9e948b9205ca3b7a9983e8f51bc4 (diff) |
get x->x_curdir using canvas_getdir()
svn path=/trunk/externals/unauthorized/; revision=15218
-rw-r--r-- | playlist.c | 25 |
1 files changed, 5 insertions, 20 deletions
@@ -886,26 +886,11 @@ static t_playlist *playlist_new(t_symbol *s, int argc, t_atom *argv ) x->x_dentries = NULL; // get current directory full path - x->x_curdir = ( char * ) getbytes( MAX_DIR_LENGTH ); - -#ifdef _WIN32 - char path[_MAX_DIR]; - - _getcwd (path, _MAX_DIR); - post ("Current directory is: %s", path); - tmpcurdir = path; - -#else - tmpcurdir = getenv( "PWD" ); -#endif - - if ( tmpcurdir == NULL ) - { - post( "playlist : could not get current directory ( where the hell are you ??? )" ); - return NULL; - } - strncpy( x->x_curdir, tmpcurdir, strlen( tmpcurdir ) ); - x->x_curdir[ strlen( tmpcurdir ) ] = '\0'; + t_symbol *cwd = canvas_getdir(canvas_getcurrent()); + int cwdlen = strlen(cwd->s_name); + x->x_curdir = ( char * ) getbytes( cwdlen ); + strncpy( x->x_curdir, cwd->s_name, cwdlen ); + x->x_curdir[ cwdlen ] = '\0'; x->x_selected = 0; x->x_itemselected = -1; |