forked from coding/Coding-iOS
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFileChange.m
More file actions
33 lines (30 loc) · 871 Bytes
/
FileChange.m
File metadata and controls
33 lines (30 loc) · 871 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
//
// FileChange.m
// Coding_iOS
//
// Created by Ease on 15/6/2.
// Copyright (c) 2015年 Coding. All rights reserved.
//
#import "FileChange.h"
@interface FileChange ()
@property (readwrite, strong, nonatomic) NSString *displayFilePath, *displayFileName;
@end
@implementation FileChange
- (void)setPath:(NSString *)path{
_path = path;
NSRange range = [_path rangeOfString:@"/" options:NSBackwardsSearch];
if (range.location == NSNotFound) {
_displayFilePath = @"/";
_displayFileName = _path;
}else{
_displayFilePath = [_path substringToIndex:range.location +1];
_displayFileName = [_path substringFromIndex:range.location +1];
}
}
- (NSString *)displayFileName{
return _displayFileName? _displayFileName: @"...";
}
- (NSString *)displayFilePath{
return _displayFilePath? _displayFilePath: @"/";
}
@end