little3399 Active Member Licensed User Longtime User Jun 2, 2015 #1 HI, It seem to the File.IsDirectory function was missing in B4I ? Is there a same method should be using ? Tks!
HI, It seem to the File.IsDirectory function was missing in B4I ? Is there a same method should be using ? Tks!
Erel B4X founder Staff member Licensed User Longtime User Jun 2, 2015 #2 It will be added in the next update. For now you can use this code: Code: Copy Sub IsDirectory(Dir As String, FileName As String) As Boolean Dim filetype As String = File.GetAttributes(Dir, FileName).Get("NSFileType") Return filetype = "NSFileTypeDirectory" End Sub Upvote 0
It will be added in the next update. For now you can use this code: Code: Copy Sub IsDirectory(Dir As String, FileName As String) As Boolean Dim filetype As String = File.GetAttributes(Dir, FileName).Get("NSFileType") Return filetype = "NSFileTypeDirectory" End Sub
little3399 Active Member Licensed User Longtime User Jun 2, 2015 #3 HI, Erel I using your code , but it show error ... and I had upload the program source code for you ... Tks! Attachments upload_2015-6-2_15-17-10.png 180.9 KB · Views: 472 B4iTest.zip B4iTest.zip 1.1 KB · Views: 348 B4iTest.zip B4iTest.zip 1 KB · Views: 326 Upvote 0
HI, Erel I using your code , but it show error ... and I had upload the program source code for you ... Tks!
Erel B4X founder Staff member Licensed User Longtime User Jun 2, 2015 #4 Note that you can right click on the logs to copy them. It is better than a screenshot. I guess that there is no such file or directory. You can check it with File.Exists before you call IsDirectory. Upvote 0
Note that you can right click on the logs to copy them. It is better than a screenshot. I guess that there is no such file or directory. You can check it with File.Exists before you call IsDirectory.
little3399 Active Member Licensed User Longtime User Jun 2, 2015 #5 Error getting attributes: Error Domain=NSCocoaErrorDomain Code=260 "The operation couldn’t be completed. (Cocoa error 260.)" UserInfo=0x170268400 {NSFilePath=/var/mobile/Containers/Data/Application/D694812A-9867-438B-8A4D-13BA5FE25CC2/Documents/B4iDir, NSUnderlyingError=0x170058720 "The operation couldn’t be completed. No such file or directory"} Upvote 0
Error getting attributes: Error Domain=NSCocoaErrorDomain Code=260 "The operation couldn’t be completed. (Cocoa error 260.)" UserInfo=0x170268400 {NSFilePath=/var/mobile/Containers/Data/Application/D694812A-9867-438B-8A4D-13BA5FE25CC2/Documents/B4iDir, NSUnderlyingError=0x170058720 "The operation couldn’t be completed. No such file or directory"}
Erel B4X founder Staff member Licensed User Longtime User Jun 2, 2015 #6 My assumption was correct. You need to use File.Exists before you can check whether the entry is a file or a folder. Upvote 0
My assumption was correct. You need to use File.Exists before you can check whether the entry is a file or a folder.