I'm working on a cocoa app that copies files to a user defined folder, and I'm currently testing it with a network drive. When I get the location of the network drive from the standard cocoa file browser, it looks like "/Volumes/Media". This works fine usually. There seems to be an issue though that I can't quite seem to work out where when I disconnect from my WIFI network, the Media drive remains mounted (I see it in /Volumes) but it is not accessible. Then when I reconnect the network, the drive is mounted to /Volumes/Media-1. I still see the original unusable /Volumes/Media drive until I restart my computer.
My question is a two parter. First, does anyone have any ideas why my drive may be staying "mounted" in my /Volumes folder even though I'm disconnected from the network. And secondly, I noticed that iTunes doesn't seem to be phased by this change of Volume name (from Media to Media-1). It is able to notice that the content it was originally accessing on /Volumes/Media, is now on /Volumes/Media-1 and continues functioning without a hitch. How might I go about detecting that name change and updating the path that I have stored in my app?
I'm trying this on OSX Lion by the way.
I asked the same question on Ask Different :
How to prevent the “-1” suffix in network drive paths?
Related
I am a high school CS teacher teaching C++ with Xcode. In the past, I have used Google Backup and Sync such that my kids shared a Google Drive folder with me, saved all their work locally in their Google Drive folder, and synced this folder with Google Drive's cloud. Worked like a charm. Now, our school has transitioned to Google FileStream, which works differently. Google Drive is now treated as a mounted volume and by default does not copy synced folders, but provides links to them on the cloud, so they appear to be local, but are in fact not. I am able to have my kids set their class folder in "offline mode" so that they can use it as before, maintaining local file copies as well as syncing with Google Drive's cloud. However, I just discovered that this results in a "permission denied" error when trying to execute their code. Projects build, but do not run.
I had them move their project folders to their desktop, and they build and run just fine. When saved on the FileStream mount, even attempting to run a successfully built project through terminal results in the same "permission denied" response. So I am 100% sure the issue here is trying to run executable code from the FileStream mounted folder.
Any thoughts here? Is there a Mac security setting somewhere that I cannot find that will allow this? Or is this a Google Drive thing? I can always have them work locally, then copy the project over, but that is a real pain for them and me with grading from home.
I am running macOS High Sierra and using iCloud Drive. My mac recently ran low on storage so it automatically offloaded a bunch of my documents. This should always be seen as a good thing, it is working as expected. However my Mac offloaded my 20GB Windows Virtual Machine, forcing me to re-download the entire file before I could use Parallels again.
Is there a way to stop iCloud from offloading certain files?
You will need to create a folder one level up to store your VMs. In Finder, click Macintosh HD, then Users, Then your profile (your login name). This is your home folder. Once there, Click on the gear and creat a new folder named Virtual Machines (or just VMs) and move your VMs there.
You can create many different folders here and whey will not sync. Only Desktop and Documents will sync. For example, I have a folder called TEMP that has my draft documents for projects only on my local machine.
Hope that helps!
I've found some remnant documents on one of my hard drives that were somehow encrypted (appearing green in Windows 7 Ultimate x64).
I've attempted to uncheck Encryption in their properties, but I get access denied. I've figured this to be because the files were from a previous format/iteration of my desktop setup, and must have somehow inadvertently gotten encrypted. (I now believe it had something to do with transferring them at one point onto a Mac machine/drive, and then back, not realizing that they were encrypted until post-format).
I originally posted in this question that I thought I had a VMware image from the same time period as the files, and that perhaps it'd be possible to transfer the key from that image to my current machine, but that image is not the right one! :/ I don't have an image that goes back further.
I've tried copying the files to a FAT32 USB drive (as it would strip the encryption), but Windows 7 denies that (understandably). And as expected, trying to drag/copy the files from my current machine onto the VMware running machine also gets denied, as VMware is running within Win7's domain and rules.
Any ideas? What about booting my current machine off of a linux live USB stick, and then attempting to copy the NTFS encrypted files onto a FAT32 partition (thus removing the encryption) -- Would that work, seeing as how Windows wouldn't be "awake" to prohibit copying?
I found a zip archive where these files originated from. Whenever I extracted them, however, they'd appear green. Sure enough, there's also a MACOSX folder in the zip file (no idea why Windows decides to encrypt anything that's coming from a Mac).
I was able to copy the zip file onto the old VMware image of mine and extract the zip file there. It still came up as encrypted, but right clicking the folder, clicking properties, and unchecking Encryption fully decrypted the folder and files!
I'd assume that even though this VMware image's machine name was different from the user record within the file's encryption information, it likely was actually the same, originating machine and subsequent encryption certificates.
Anyway, I was able to copy the decrypted files back, and now the problem's solved!
Is there any way, any chance at all to access entire filesystem in SL app with elevated trust?
That will work both in Windows and Mac?
Through AutomationFactory,PInvoke or unmanaged code?
I need an app that could read local drives, folders and files.
UDP: Ok, seems it's possible to read folders and files using classes of System.IO from mscorlib. Although you still can't get information about local mounted drives. There is no DriveInfo in Silverlight's mscorlib :(
Ok I have an idea about this.
It is straightforward enough with Windows, to get the list of the local drives you can use AutomationFactory. There is plenty amount of examples if you google it. Search for something called SilverlightFileExplorer.
Now on a Mac you can use Directory.EnumerateDirectories("/") and then it gets all the folders in the root. Including Volumes folder which contains shortcuts to the local drives. I'm not an expert of Berkeley System Distribution (BSD) Unix filesystems, so I can't really promise that it would work on any Mac, but this approach works on mine.
I'm still playing around with that. When I get working prototype I'll probably share it through github or something.
I want my OS X app to share files via the loopback device. I want to do this so that my app can make a directory of frequently changing, read only files available to the user without messing with the users home directory. The files will be severed from the Application Support directory but the user will not have to concern themselves with this.
Apple recommend using an NFS server to do this (see the 'alternatives' section of this Q&A):
http://developer.apple.com/mac/library/qa/qa2001/qa1242.html
As far as I can tell nfsd must be ran as root, which I'd prefer to avoid (asking the user for a password whenever the app starts would be a horrible UX).
Is it possible to start an nfsd instance without root?
Are there any alternative NFS servers which I could include with the app? (I couldn't find any)
Are there any alternatives servers that I could use? (The server would have to be AFP, SMB or WebDAV as these are the protocols that Finder can mount - I couldn't find any such servers).
I'm not sure I understand your use case but have you considered using a file system mounted from an OS X disk image? Disk images on OS X are very robust and very flexible: you can pretty much have any kind of file system(s) created on one image and can mount or dismount them at will and at whatever mount point(s) you like. See the man page for hdiutil for more info.
If the "files" you are trying to serve are not actually disk files, then you might want to look at MacFUSE, the mostly widely used implementation of FUSE for OS X.
Use MacFUSE. This is by far the easiest way to implement a file system.