• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to detect Time Machine volume?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to detect Time Machine volume?


  • Subject: Re: How to detect Time Machine volume?
  • From: Stephane Sudre <email@hidden>
  • Date: Tue, 02 Aug 2011 19:37:22 +0200

This code would work in most cases but is actually unreliable.

Obvious cases: you have 2 text files with these names ar the root of a
partition.
Worse case: an old time machine partition has been replaced by a new
one. Since the old partition is some kind of a second backup, the user
has not removed the Time Machine files.

For Boot Camp, I tend to believe it's possible to get the information
using the statfs API.

For Time Machine, maybe it's safe to get the info from the
/Library/Preferences/com.apple.TimeMachine.plist file (assuming it's
there).


On Tue, Aug 2, 2011 at 5:57 PM, Leonardo Borsten
<email@hidden> wrote:
> Hello,
>
> What is the most reliable way to detect in code if a mounted volume is the Time Machine disk?
> Currently I'm using the following code (also to detect a Boot Camp volume):
>
> - (Boolean)isNotSearchable:(NSString *)volumePath
> {
>
> NSFileManager *fm = [NSFileManager defaultManager];
>
>        NSString *timemachine = [volumePath stringByAppendingPathComponent:@"Backups.backupdb"];
>        NSString *winSystem = [volumePath stringByAppendingPathComponent:@"MSDOS.SYS"];
>
>        if ([fm fileExistsAtPath:timemachine]) return YES;
>        if ([fm fileExistsAtPath:winSystem]) return YES;
>
>        return NO;
> }
>
> This works fine on my system. Will this code work reliably on my user's systems? Is there a better way?
> The same question can apply for iDisk and iCloud, probably.
>
> The reason I need to know is that I have a function using FSCatalogSearch where I definitely don't want to access these type of volumes.
>
> Thanks!
>
>
> Leonardo Borsten
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
>
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: How to detect Time Machine volume?
      • From: Charles Srstka <email@hidden>
References: 
 >How to detect Time Machine volume? (From: Leonardo Borsten <email@hidden>)

  • Prev by Date: Re: Why Don't Cocoa's (Un)Archiving Methods return Errors?
  • Next by Date: Re: Cocoa-dev Digest, Vol 8, Issue 595
  • Previous by thread: How to detect Time Machine volume?
  • Next by thread: Re: How to detect Time Machine volume?
  • Index(es):
    • Date
    • Thread