forked from tinymind/LSUnusedResources
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
hanshaopengkael
committed
Apr 25, 2016
1 parent
dd68f74
commit ef6874c
Showing
7 changed files
with
82 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// | ||
// LSFileUtils.h | ||
// LSUnusedResources | ||
// | ||
// Created by jhgfer on 16/4/25. | ||
// Copyright © 2016年 lessfun.com. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
@interface LSFileUtils : NSObject | ||
/** | ||
* get file size, ignore directory | ||
* @param path path | ||
* @param isDir | ||
* | ||
* @return | ||
*/ | ||
+ (uint64_t)fileSizeAtPath:(NSString *)path isDir:(BOOL *)isDir; | ||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// | ||
// LSFileUtils.m | ||
// LSUnusedResources | ||
// | ||
// Created by jhgfer on 16/4/25. | ||
// Copyright © 2016年 lessfun.com. All rights reserved. | ||
// | ||
|
||
#import "LSFileUtils.h" | ||
|
||
@implementation LSFileUtils | ||
+ (uint64_t)fileSizeAtPath:(NSString *)path isDir:(BOOL *)isDir { | ||
uint64_t size = 0L; | ||
NSError *error = nil; | ||
NSDictionary *attr = [[NSFileManager defaultManager] attributesOfItemAtPath:path error:&error]; | ||
if (!error) { | ||
*isDir = [attr[NSFileType]isEqualToString:NSFileTypeDirectory]; | ||
if (!*isDir) { | ||
size = [attr[NSFileSize] unsignedLongLongValue]; | ||
} | ||
} | ||
return size; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.