Nico
Nico

Reputation: 1838

.DS_Store file in iPhone

In Mac OS ".DS_Store" files are used by Mac OS X to store folder specific metadata information. They are created in every folder that Mac OS X Finder accesses, even network volumes and external devices.

i used this code to remove the Pvt folder in library sandbox in iPhone.

I have the directories hierarchy in PVT Folder in library folders that's why i am asking this question, and here i am only giving this sample code for you to understand this question in the better way.

-(NSArray*)ReturnsLibraryDirectoryContainsInArray
{
NSString *exportPath = [AppDelegate applicationLibraryDirectory];

BOOL isDir=NO;
NSArray *subpaths = [[NSArray alloc] init];

// NSString *exportPath = docDirectory;

NSFileManager *fileManager = [NSFileManager defaultManager];

if ([fileManager fileExistsAtPath:exportPath isDirectory:&isDir] && isDir)
{
    subpaths = [fileManager subpathsAtPath:exportPath];

    NSMutableArray * dirContents = [[NSMutableArray alloc] initWithArray:subpaths];

    if([subpaths containsObject:@".DS_Store"])
    {
        [dirContents removeObject:@".DS_Store"];
    }

    subpaths = dirContents;
}

return subpaths;}


this methods returns NSArray object which keep the information of the inner side files in PVt lib, well i tried to remove the code

[dirContents removeObject:@".DS_Store"];


from the above code and in iPhone it works fine but i am not sure if i removed the above code then what would actually happens?

If iOS don't create .DS_Store file to manage directories then does iOS create such kind of other files to keep information of directories/folders hierarchy?

Upvotes: 1

Views: 3509

Answers (1)

Pradhyuman sinh
Pradhyuman sinh

Reputation: 3928

The .DS_Store file is a file created by OS that holds meta-information about a directory. You can expect to always find it and can safely ignore it. The file is not shown by the Finder.

Upvotes: 2

Related Questions