1 - Are there Examples of an error handling method?
2 - Where are the listing on XOJO of the errors?
3 - Which am I doing wrong?
I routinely take a partial path and store the string (fppath) of a nativepath (f1) by subtracting a parent’s nativepath (f2) from f1.
The code for subtraction would be:
fpath as string
f1, f2 as folderitem
fpath = replace(f1.nativepath, f2.nativepath, "")
I will then recompose the path later using this:
f as folderitem
f = f2.child(fpath)
if f = Nil Or f.Exists = False Then//throws an error
An example of the partial path which is causing a problem on a Mac is [quote]Teach Me Korean/Pages 9b to 12.txt[/quote]
This is a file in a subfolder. I just started getting the error lasterrorcode 101 on my Mac only.
I went looking for looking for my code saved as examples for error handling and couldn’t find it? I also couldn’t find anything on XOJO.
I did find an old article in RealBasic Developer from 8.6 called Trapping Errors, which is complex and good for future reference.
So. Question 1. Are there any examples less complicated than the above?
Question 2. I cannot find on XOJO any listing of possible lastobjectcode or similar listings. Where are they?
Question 3. Which am doing wrong with the recompose?
Is it that it is composed of folders and a file name?
Or is something else like getfolderitem required?
or in the local reference under Help > Language Reference and finding folderitem.lasterrorcode
I dont have that specific reference so I dont know if there are “less complex” ones
Checking for nil and last error code is about all you should need to do
[quote=339525:@Arthur Gabhart]Question 3. Which am doing wrong with the recompose?
Not sure since the code doesnt show the contents of the various paths
Sorry about not adding the full path
Do you need more?
still cant tell since I have no idea whats in F1 or F2 or fpath that you use in this code
f1 would be [quote]/Users/arthurgabhart/Documents/Korean Language/TextFiles/Teach Me Korean/Pages 9b to 12.txt[/quote]
f2 would be [quote]/Users/arthurgabhart/Documents/Korean Language/TextFiles[/quote]
A list of files comes from a recursion of the directory.
Never Mind. Found out I’d changed some code recently.
You have the full path, rip it apart, just to put it back together ???
Since I have no idea what it is you’re trying to achieve I
- created all the same folder hierarchy that you appear to have (under my user name documents etc)
- created a text file in there with the same name
- wrote this code
- stepped through this code line by line in the debugger
- f ends up pointing to the exact file no errors etc
Dim fpath As String
Dim f1, f2 As folderitem
f1 = GetFolderItem("/Users/npalardy/Documents/Korean Language/TextFiles/Teach Me Korean/Pages 9b To 12.txt", FolderItem.PathTypeNative)
f2 = GetFolderItem("/Users/npalardy/Documents/Korean Language/TextFiles", FolderItem.PathTypeNative)
fpath = Replace(f1.nativepath, f2.nativepath, "")
Dim f As folderitem
f = f2.child(fpath)
my only conclusion is there’s “something” in your code you’re doing or not telling me that causes the problem
but I cant guess at what that might be
I had removed code that broke down the path into folderitems. I’m amazed that windows took it