Emulate virtual hard drive using Cocoa - cocoa

Is it possible to sort of emulate a hard drive, utilizing Cocoa? I have a backup application, and I want my users to be able to browse their files outside of the app, in Finder, for example.
So, how would I be able to accomplish this? I know that some apps (Transmit) do it, but I have no idea how they do it. My best guess is that they add a folder somewhere in /Volumes, and then somehow mount it.

you should read about MacFuse. Read its Objective-C API here

Related

Cocoa class to check which running apps are accessing disks

I am working on a simple Disk utility type application. I would like to add a feature that lists which running application's are currently accessing a particular disk. I'm not really sure which Cocoa Class implements this.
Just to elaborate, the closest description of what I'm looking for is the alert that appears when trying to unmount a disk in use. The alert goes something like "Disk so and so can not eject because application so and so is using it." How do I check which applications are currently accessing a specific drive.
Hope someone can point me in the right direction.

HFS+ Read access in Windows

I need to read and write some files on a HFS+ (Mac) partitioned drive and wondering is there any APIs for that already made, googleing didn't come up with anything. If not, how does one approach this problem from scratch.
There is no API, just drivers. I would recommend you to learn how to use google. ;) It's the very first hit.
Try Macdrive
or paragon sw

WP7 - Clearing Isolated Storage for my application

I would like the users to be able to wipe out their isolated storage for my application and start over. Is there a way to do this? Is this suggested? If so to both prior questions, what is the best way to do this?
Update:
After thinking about this question a little bit, I'm thinking I can probably look through my collection and do a remove operation... So I guess that is one way. Is there a more complete way?
You can do this with IsolatedStorageFile.Remove. It removes all the contents of the application's Isolated Storage.
Have you taken a look at the Isolated Storage Best Practices for Windows Phone? I think you would simply implement this through functionality in your app that gives user access to the relevant directory in the isolated storage scope and allows them to delete specific or in your case, all files. The second link has examples of how to do this.

How to mimic a drive in Windows

I recently had a look at the Google Data API. Its looking good.
What I want to do is create a "G Drive" Type application. This will basically come up as a drive in explorer with its own icon. From there you will be able to drag and drop operations to and from Google Docs, and create folders. Yes I've heard of Gladinet and Memeo, but both are not great solutions. I've decided to build one from the ground up, and release it as open source, once its in Alpha.
Anyways to get started I need some advise.
Clearly I need a way to mimic a drive in explorer. Is it possible to create some kind of virtual drive then have its contents list from an XML file, rather than a folder on the HDD?
So if the XML file (for example) contained a collection of elements, would it be possible to have these elements (with some work) show up in an explorer window for the drive. Almost like changing the data source for the explorer view from file system to contents of a file?
Hack or not, elegant or messy, has anyone found some way to go about doing this?
The Dokan project may be what you're looking for
Instead of creating a drive look into creating a namespace which is how the Google Drive works
Just as a reference: virtual drives can be created using our Callback File System product, which is a supported, documented and maintained solution.

How does the DropBox Mac client work?

I've been looking at the DropBox Mac client and I'm currently researching implementing a similar interface for a different service.
How exactly do they interface with finder like this? I highly doubt these objects represented in the folder are actual documents downloaded on every load? They must dynamically download as they are needed. So how can you display these items in finder without having actual file system objects?
Does anyone know how this is achieved in Mac OS X?
Or any pointer's to Apple API's or other open source projects that have a similar integration with finder?
Dropbox is not powered by either MacFUSE or WebDAV, although those might be perfectly fine solutions for what you're trying to accomplish.
If it were powered by those things, it wouldn't work when you weren't connected, as both of those rely on the server to store the actual information and Dropbox does not. If I quit Dropbox (done via the menu item) and disconnect from the net, I can still use the files. That's because the files are actually stored here on my hard drive.
It also means that the files don't need to be "downloaded on every load," since they are actually stored on my machine here. Instead, only the deltas are sent over the wire, and the Dropbox application (running in the background) patches the files appropriately. Going the other way, the Dropbox application watches for the files in the Dropbox folder, and when they change, it sends the appropriate deltas to the server, which propagates them to any other clients.
This setup has some decided advantages: it works when offline, it is an order of magnitude faster, and it is transparent to other apps, since they just see files on the disk. However, I have no idea how it deals with merge conflicts (which could easily arise with one or more clients offline), which are not an issue if the server is the only copy and every edit changes that central copy.
Where Dropbox really shines is that they have an additional trick that badges the items in the Dropbox folder with their current sync status. But that's not what you're asking about here.
As far as the question at hand, you should definitely look into MacFUSE and WebDAV, which might be perfect solutions to your problem. But the Dropbox way of doing things, with a background application changing actual files on the disk, might be a better tradeoff.
Dropbox is likely using FSEvents to watch for changes to the file system. It's a great API and can even bundle up changes that happened while your app was not running. It's the same API that Spotlight uses. The menubar app likely does the actual observing itself (since restarting it can fix uploads being hung, for instance).
There's no way they're using MacFUSE, as that would require installing the MacFUSE kernel extension to make Dropbox work, and since I definitely didn't install it, I highly doubt they're using it.
Two suggestions:
MacFUSE
WebDAV
The former will allow you to write an app that appears as a filesystem and does all the right things; the latter will allow you move everything server-side and let the user just mount your service as a file share.
Dropbox on the client is written in python.
The client seems to use a sqlite3 database to index files.
I suppose Dropobox split a file in chunks, to reduce bandwith usage.
By the way, it two people has the same file, even if they do not know each other, the server can optimize and avoid to transfer the file more times, only copying it on the server side
To me it feels like a heavily modified revision control system. It has all the features: updates files based on deltas, options to recover or restore old revisions of files. It almost feels like they are using git (GitFS?), or some filesystem they designed.
You could also give File Conveyor a try. It's a Python daemon capable of instantly detecting FS changes (on Linux through inotify, on OS X through FSEvents), processing the files and syncing them to one or more destinations.
Supported protocols: FTP, SFTP, Amazon S3 (CloudFront is also supported), Rackspace Cloud Files. Can easily be extended. Uses django-storages.
"processing files": e.g. optimizing images, transcoding videos — this was originally conceived to be used for sending static assets to a CDN in the context of speeding up websites)

Resources