New topic: Save SpecialFolder in database string and recall
<http://forums.realsoftware.com/viewtopic.php?t=32266> Page 1 of 1 [ 2 posts ] Previous topic | Next topic Author Message asksteve Post subject: Save SpecialFolder in database string and recallPosted: Sun Jan 31, 2010 12:35 am Joined: Sun Jul 05, 2009 3:12 pm Posts: 64 Location: Ajax, Ontario Canada I'm having a strange problem, I need to upgrade my database so that it contains a new column. This is because there are customers out there using the product and I need to add a new column to add new functionality. The new column is a folderitem path as string. I add the column and then I update the column record with a generic path like this: Code:rec = app.db.SQLSelect("select Path from UserList where ID=1") rec.Edit rec.IdxField(1).Value = "SpecialFolder.ApplicationData.Child("MyCompany").child("CoolProduct")" rec.Update However now I need to get that back into my program and convert it to a folderitem using: Code:Dim r as RecordSet dim f as FolderItem r=app.db.SQLSelect("select Path from UserList where ID=01") f=New FolderItem(r.field("VideoPath").StringValue, FolderItem.PathTypeAbsolute) App.programPath = f This looks like it would work but f actually contains the path to the RB project and then the path from the database column. Like this: Macintosh HD:Users:Computer:Desktop:MyProduct:SpecialFolder.ApplicationData.Child("MyCompany").child("CoolProduct") Is the problem that SpecialFolder cannot be used this way? Maybe I need to convert it to an absolute first? I would rather keep it SpecialFolder. Any ideas? Top jefftullin Post subject: Re: Save SpecialFolder in database string and recallPosted: Sun Jan 31, 2010 2:43 am Joined: Wed Nov 15, 2006 3:50 pm Posts: 1265 If you are constraining the user to files in the SpecialFolder, you only need to store the 'rest' of the path. Check out GetSaveInfo in the LR As to the current code, "SpecialFolder.ApplicationData.Child("MyCompany").child("CoolProduct")" is not an absolute path In theory, you could store the actual absolutepath : Code:dim f as folderitem f = SpecialFolder.ApplicationData.Child("MyCompany").child("CoolProduct") //no strings attached rec.Edit rec.IdxField(1).Value =f.absolutepath rec.Update But this is frowned upon , especially on the Mac. I guess there is a chance that the path may have changed when you come back next time: but you could always check for .exists Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 2 posts ] -- Over 1500 classes with 29000 functions in one REALbasic plug-in collection. The Monkeybread Software Realbasic Plugin v9.3. http://www.monkeybreadsoftware.de/realbasic/plugins.shtml [email protected]
