New topic: MoveFileTo doesn't update FolderItem after move-Easier way?
<http://forums.realsoftware.com/viewtopic.php?t=46231> Page 1 of 1 [ 1 post ] Previous topic | Next topic Author Message HardyMachia Post subject: MoveFileTo doesn't update FolderItem after move-Easier way?Posted: Thu Dec 13, 2012 11:58 am Joined: Mon Dec 11, 2006 12:25 pm Posts: 59 Is there a simpler way to do this? MoveFileTo doesn't update the paths so I'm recreating FolderItems before and after everything What I'm trying to accomplish: User opens an existing data file and I'm want to convert it to a OS X bundle which means I need to replace the file they picked with a folder containing the file (and I'm going to rename the file to 'mydatabase.sql' so it's standard name within the bundle. // have user pick an existing database file Dim dbFile As FolderItem = GetOpenFolderItem(FileWrapperFileTypes.ApplicationFileWrapper) if (dbFile.Directory = False) Then // Plain file -- convert it to a bundle // create new bundle folder in Temporary location with existing data file name Dim bundleFolder As FolderItem = SpecialFolder.Temporary.Child(dbFile.Name) bundleFolder.CreateAsFolder // save this for later Dim dbFileParent As FolderItem = dbFile.Parent // move current data file into the bundle dbFile.MoveFileTo bundleFolder // get folderitem for file we moved into the bundleFolder so we can rename it Dim bundleDataFile As FolderItem = SpecialFolder.Temporary.Child(dbFile.Name).Child(dbFile.Name) // rename the file to our standard datafile name bundleDataFile.Name = "mydatabase.sql" // move bundle back to where user had it originally bundleFolder.MoveFileTo dbFileParent // get a reference to the original database file now inside the new bundle dbFile = dbFileParent.Child(bundleFolder.name).Child("mydatabase.sql") end if _________________ http://www.catamount.com PocketMoney for iOS, OSX, Linux, Windows, and Android Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 1 post ] -- 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]
