I just tried and not producing the expected result.. path::get-directory-name("c:\my-folder\") returns the full path of the parent folder and path::get-directory-name("c:\my-folder\*.*") returns the full path of the folder.
In this example, the result would have been "my-folder". I still believe that if the function is called "get-directory-name", it should return the name of the directory both if the path is a directory and if the path is a file. Since the string::substring() doesn't have a overload in which i shouldn't provide the length of the substring, I think I'll make a path function that would provide the directory info i need. Cheers, Daniel On 2/14/07, Rod Ayers <[EMAIL PROTECTED]> wrote: > Have you tried: > path::get-directory-name("c:\my-folder\") > > or > > path::get-directory-name("c:\my-folder\*.*") > > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] Behalf Of Daniel > Blendea > Sent: Wednesday, February 14, 2007 8:11 AM > To: Bob Archer > Cc: nant-users@lists.sourceforge.net > Subject: Re: [NAnt-users] bug in path::get-directory-name()? > > > Indeed... > > [Function("get-directory-name")] > public static string GetDirectoryName(string path) { > string dirName = Path.GetDirectoryName(path); > return StringUtils.ConvertNullToEmpty(dirName); > } > > the function is a wrapper around the equivalent .NET method. > > so i take it that the only 2 options i have are: > 1 - use string related functions > 2 - extend nant.... > > Daniel > > On 2/14/07, Bob Archer <[EMAIL PROTECTED]> wrote: > > You may want to get the code and look at the tests for this function. > > But, I assume it returns everything in a string prior to the final > > back(forward)slash. Since it returns a string the information is > > apparently just the path name. > > > > BOb > > > > -----Original Message----- > > From: [EMAIL PROTECTED] > > [mailto:[EMAIL PROTECTED] On Behalf Of Daniel > > Blendea > > Sent: Wednesday, February 14, 2007 10:48 AM > > To: nant-users@lists.sourceforge.net > > Subject: [NAnt-users] bug in path::get-directory-name()? > > > > Hi all, > > > > I'm trying to use path::get-directory-name(<path>) and if <path> is a > > directory > > the function returns the parent directory. > > > > Is this the correct behaviour? because i think it isn't. > > > > The description of the function is rather vague: > > "Returns the directory information for the specified path string. " > > > > What directory information? size? subfolders? > > > > Thank you for your reply. > > Daniel > > > > ------------------------------------------------------------------------ > > - > > Take Surveys. Earn Cash. Influence the Future of IT > > Join SourceForge.net's Techsay panel and you'll get the chance to share > > your > > opinions on IT & business topics through brief surveys-and earn cash > > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDE > > V > > _______________________________________________ > > NAnt-users mailing list > > NAnt-users@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/nant-users > > > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys-and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > NAnt-users mailing list > NAnt-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/nant-users > ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ NAnt-users mailing list NAnt-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nant-users