Duh, you are right. No loop is needed for what I want! function isPath pSomePath set itemDel to slash if there is not a folder pSomePath then -- remove the last item and try again delete last item of pSomePath if there is not a folder pSomePath then return false -- neither the path, nor the path less a filename, is a valid folder path end if end if return pSomePath -- this is either a valid path of folders or the folder portion of a path with a file name removed end is Path
Thank you. On 10/10/2018 11:38 AM, Bob Sneidar via use-livecode wrote: > there is a folder returns false on Mac if it's a file. Unless the file is a > bundle (app). A Mac app is in fact a folder that has been flagged as an > application. > > Looking at your code, are you trying to extract the paths to all the files, > or determine which are folders inside a given path? If you are just trying to > determine if a path is just a folder, then there is a folder will return > false if it is a path to a file. > > Bob S > > >> On Oct 10, 2018, at 08:29 , Paul Dupuis via use-livecode >> <use-livecode@lists.runrev.com> wrote: >> >> Lets say you have a bunch of file paths - some are just paths (all >> folders) and some end in a file name (and the file may or may not exist). >> i.e. >> /Folder1/Folder2/Folder3 >> /Folder1/AnotherFolder/Somefile.txt >> /Folder1/Folder2/Folderwith.intheName >> How would you test to tell whether a given record is just a path of >> folders or contains a file name? Is there any way other than looping >> through the path and testing if each "folder" exists? >> All, I can come up with is: >> function isPath pSomePath >> local tJustAPath = true >> set itemDel to slash >> repeat with i=1 to the number of items in pSomePath >> if there is not a folder (item 1 to i of pSomePath) then >> put false into tJustAPath >> exit repeat >> end if >> end repeat >> return tJustAPath >> end isPath >> >> Is there some OS of LiveCode trick I am missing? >> >> >> _______________________________________________ >> use-livecode mailing list >> use-livecode@lists.runrev.com >> Please visit this url to subscribe, unsubscribe and manage your subscription >> preferences: >> http://lists.runrev.com/mailman/listinfo/use-livecode > > _______________________________________________ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription > preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode > _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode