Windows driving me nuts


I have an app which I have developed on the Mac, and at one stage I transferred it over to Windows just to see if I could open it as it connects to a database. It opened just fine.

I then had to do some final touches to the program, which I did on the Mac, then I transfered the Xojo Project to my Windows VM on my Mac. As usual I had to tweak a couple of things in the UI.

Then when I came to run it it gave the error message that it couldn’t find the database on disk (I supply the error message).

The sqlite file is sitting in the same folder as the Xojo binary file. My Code for getting the sqlite file is:

[code] Shared Function setupNewDatabase() As PoultryDatabase
'Make sure we can get to the Poultry_db database on disk
Dim dbFile As FolderItem = GetFolderItem(“Poultry_db.sdb”)
If dbFile = Nil Or dbFile.Exists = False Then
MsgBox(“Could not find database on disk.”)
Return Nil
End If

Dim Poultry_db As New PoultryDatabase
Poultry_db.DatabaseFile = dbFile
If Not Poultry_db.Connect Then
MsgBox("Could not connect to " + dbFile.Name)
Return Nil
End If
Return Poultry_db

End Function[/code]

When I look at the Absolute Path in the debugger it is: “MacintoshHD:Users:cliffgs:Documents:CliffsStorage:ArnoldAcresResources:PoultryClubProject:Poultry_db.sdb”

On Windows it is: “C:\Users\cliffgs\PoultryClubProject\DebugClasses Selection\Poultry_db.sdb”

Where is the “\DebugClasses Selection” coming from, and what difference should it make if it is something Xojo requires to do to work on WIndows.

GetFolderItem(someFileName) will not start looking in the same folder for a file depending on if you run your project from the IDE or when you run the compiled version.

Cliff you’re going to run into problems placing your database in the program folder. Put it in Specialfolder.documents and it will work in both debug & built mode. And more importantly it will work on your client’s pc’s even with xplat.

Thanks Eli and Wayne

I guess I will have to get a book on Windows so that I can learn more about it. I have until the end of this year to get this program running (and able to be installed) properly. Do you have any suggestions for such a book? Or perhaps a good website?

But what if the user’s My Documents folder is moved off of the local C: drive and placed on a network drive (which is not uncommon for some IT departments to do)? If the user is disconnected from the network, then they will not be able to reach the folder or the file. We run into this about 10 times a year with customers still on our old VB6 version which places a database in the user’s My Documents folder. A better place for a database is in SpecialFolder.ApplicationData…