I’ve got the following code in an app I’m trying to move from RS to Xojo and it is no longer working in Xojo. I’ve tried from 2013R2 thru the current beta with no success. What I’m seeing is that the code executes with no exception being raised but the file isn’t being moved. If someone else can confirm they are seeing this I will file the feedback report. I’m running OS X 10.6.8.
Dim Fi As FolderItem
Dim File As FolderItem
Fi = GetFolderItem(DestLoc, FolderItem.PathTypeNative)
File = GetFolderItem(CurrentLoc, FolderItem.PathTypeNative)
If Fi <> Nil Then
Catch ex As IOException
Ok, the error was a 101 - File not found. It was my fault. I had a previous GetFolderItem(“filename”) with no pathMode parameter which was a holdover from the old code.
Running this in the IDE was giving the NativePath as “/Users/dev/Documents/Xojo Projects/prj/:Users:dev:Documents:CD:Drop Folder” - so to me it looks like I’ve gotten a combination of AbsolutePath and NativePath without the pathMode parameter - is this intended behavior or should I file a feedback report?
[quote=41529:@Michael Bierly]Ok, the error was a 101 - File not found. It was my fault. I had a previous GetFolderItem(“filename”) with no pathMode parameter which was a holdover from the old code.
Running this in the IDE was giving the NativePath as “/Users/dev/Documents/Xojo Projects/prj/:Users:dev:Documents:CD:Drop Folder” - so to me it looks like I’ve gotten a combination of AbsolutePath and NativePath without the pathMode parameter - is this intended behavior or should I file a feedback report?[/quote]
GetFolderItem has to default to the ‘legacy’ path style for compatibility reasons, so passing in a native path will yield ‘incorrect’ results.
Thanks Joe. That makes sense why it does what it does.
This is for Paul - maybe this should be part of the list of things in the upgrade guide. (I haven’t looked at it since the original). I will bet that others will get bit on this upgrading their apps from RS to Xojo. As careful as I thought I was migrating my old code, I still ended up missing one that needed to be changed.
[quote=41529:@Michael Bierly]Running this in the IDE was giving the NativePath as “/Users/dev/Documents/Xojo Projects/prj/:Users:dev:Documents:CD:Drop Folder”
ReplaceAll( ,":","/") before accessing the Nativepath.
Probably that i`ll get bumps again from the team because of pig tailing the thread but i get the same issue.
No mater whatever i put in the path im getting the same 101 Error , ive tried all the options and i get the same error, really its a pain to upgrade a project from RealBasic to XOJO, i wish it was a better way of doing this, and when you have to deal with more than 100 k lines of code its a programmer nightmare.
the last atempt is something like this
[code] fi = app.patientFolderItem.child(code).child("photos")
file = photoFolderItem
Not seeing all of the code this is tough to answer. I have a couple of apps that do a lot of MoveFIleTo executions and have no problems whatsoever. Here is the method in one where it moves all of the html pages from one folder to another as a backup measure before modifying the html pages. This app has moved thousands of files over the years without any problems.Maybe something in this will give you a clue as to what your problem is:
[code] movePages(f As FolderItem, t As FolderItem) As Boolean
// This routine moves the html page files for the category being processed
// from the f, from, folder to the t, to folder. Usually this will be from the
// “browser” folder to the “old pages” folder within the “browser” folder; but,
// if an error occurs during processing after the original files were moved to the
// “old pages” folder, this same routine can be called to move things back where
// the “old pages” becomes the f, from, folderitem and the “browser” folder is
// the t, to, folderitem. Invoked from the rebuildTheCategory method
Dim fFrom, fTo As FolderItem
Dim i, nameLength, num As Integer
Dim fName, pageNameToFind, s As String
movedCount = 0 // how many files moved to the t (to) folder
pageNameToFind = catToDo.pageName // page name we are looking for, minus sequence #
nameLength = Len(pageNameToFind) // length of this page name
num = f.Count
for i = num DownTo 1 // walk through items in f (from) folder
fFrom = f.TrueItem(i)
if fFrom <> nil then
if fFrom.exists and fFrom.Visible and fFrom.IsReadable and not fFrom.Directory then
fName = fFrom.Name
if mid(fName,1, nameLength) = pageNameToFind then
fTo = t.child(fName)
if fTo.exists and fTo.visible and fTo.IsReadable and not fTo.Directory then
deleteCount = deleteCount +1 // delete any existing file in the to folder
if fFrom.LastErrorCode <> 0 then
s = "In movePages method of wPicInfo window moving files from folder " + f.Name
s = s + " to folder " + t.Name + " - "
s = s + fldrItemError(fFrom.LastErrorCode) // add kind of error to msg string
s = s + “Execution cannot continue normally.”
showAlertDialog kPgmErr, s, “Okay”, “”, “”, “a”, “”, 2
movedCount = movedCount + 1
end if // mid…
end if // fFrom.exists and …
end if // fFrom <> nil