Skip to content

Commit fdfd4ca

Browse files
author
苼茹夏花
committed
完善infoPlist文件名不为默认名称时,无法取到项目版本好问题.
完善Author未设置时,从项目的组织名称中获取.组织名称未获取到时,再获取当前系统的登录名称
1 parent cf7562f commit fdfd4ca

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

VVDocumenter-Xcode/ProjectHelper/VVProject.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ - (id)initWithName:(NSString *)name
4747
_organizeationName = [self getOrganizeationName];
4848
NSString *infoplistName = [self infoplistNameWithAtScheme:name];
4949

50-
5150
NSString *infoPath = [path stringByAppendingPathComponent:[NSString stringWithFormat:@"%@", infoplistName]];
5251

5352

VVDocumenter-Xcode/Setting/VVDocumenterSetting.m

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#import "VVDocumenterSetting.h"
1010
#import <Carbon/Carbon.h>
11+
#import "VVProject.h"
1112

1213
NSString *const VVDDefaultTriggerString = @"///";
1314
NSString *const VVDDefaultAuthorString = @"";
@@ -191,8 +192,18 @@ -(void) setUseAuthorInformation:(BOOL)useAuthorInformation
191192

192193
-(NSString *)authorInformation {
193194
NSString *authorInformation = [[NSUserDefaults standardUserDefaults] objectForKey:kVVDAuthorInfomation];
194-
if (authorInformation == nil ) {
195-
authorInformation = VVDDefaultAuthorString;
195+
if (authorInformation.length <= 0 ) {
196+
NSString *name = [[VVProject projectForKeyWindow] organizeationName];
197+
if (name.length <= 0) {
198+
NSDictionary *environment = [[NSProcessInfo processInfo] environment];
199+
name = [environment objectForKey:@"LOGNAME"];
200+
}
201+
202+
if (name.length > 0) {
203+
authorInformation = name;
204+
}else{
205+
authorInformation = VVDDefaultAuthorString;
206+
}
196207
}
197208
return authorInformation;
198209
}

0 commit comments

Comments
 (0)