Skip to content
This repository was archived by the owner on Sep 22, 2023. It is now read-only.

Commit c34f43f

Browse files
committed
完善终结版本,更新说明
1.修正后为不获取用户名,而是获取用户下个人目录方式 2.增加打印的说明截图
1 parent 5e47f7d commit c34f43f

File tree

5 files changed

+100
-26
lines changed

5 files changed

+100
-26
lines changed

LICENSE

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2015 DragonLi
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
22+

README.md

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
11
#XcodePluginUpgradeCompatible-LFL
22

3+
## 特别说明,此版本为解决Xcode插件处理终结版本(只要是xcode版本升级,导致不插件无法加载,都可以尝试使用此工程命令修正,和xcode5之后版本无关),觉得好用,还望给个star ,谢谢呀
4+
5+
### 有群里小伙伴反馈,如果电脑的用户名曾经更改而且没有更改个人目录那么获取的路径无效,修正后为不获取用户名,而是获取用户下个人目录方式.并且打印台也打印一下你插件目录安装插件都是哪些啦.
6+
37
##1.直接上图(很简单一步到位)
48

5-
![frist_Pic](https://github.com/LFL2018/PicSources/blob/master/XcodePluginUpgradeCompatible-LFL/XcodePluginUpgradeCompatible-LFL1.png)
69

7-
![Pic2](https://github.com/LFL2018/PicSources/blob/master/XcodePluginUpgradeCompatible-LFL/XcodePluginUpgradeCompatible-LFL2.png)
10+
![frist_Pic](https://github.com/LFL2018/Som_related_information_LFL/blob/master/The_picture/XcodePluginUpgradeCompatible-LFL/XcodePluginUpgradeCompatible-LFL1.png?raw=true)
11+
12+
13+
![Pic2](https://github.com/LFL2018/Som_related_information_LFL/blob/master/The_picture/XcodePluginUpgradeCompatible-LFL/XcodePluginUpgradeCompatible-LFL2.png?raw=true)
14+
15+
![Pic3](https://github.com/LFL2018/Som_related_information_LFL/blob/master/The_picture/XcodePluginUpgradeCompatible-LFL/XcodePluginUpgradeCompatible-LFL3.png?raw=true)
816

9-
![Pic3](https://github.com/LFL2018/PicSources/blob/master/XcodePluginUpgradeCompatible-LFL/XcodePluginUpgradeCompatible-LFL3.png)
17+
###1.1 新增加打印插件名
18+
![](./lastPic.png)
1019

1120
##2.1 中文说明
1221

@@ -22,4 +31,11 @@
2231

2332
### 2.How to solve and use this commandCom + R running, restartXcode Tips:reboot Xcode will require the user to confirm whether to Load the apple official plugin, please select the Load Bundles
2433

25-
## 觉得好用,还望给个star ,谢谢呀
34+
35+
### 3. 有任何问题,请及时 issues me
36+
<dragonli_52171@163.com>
37+
38+
39+
## License
40+
41+
English: this library is available under the MIT license, see the LICENSE file for more information.
4.48 KB
Binary file not shown.

XcodePluginUpgradeCompatible-LFL/main.m

Lines changed: 58 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,41 +3,72 @@
33
// Created by DragonLi on 15/12/18.
44
// Copyright © 2015年 DragonLi. All rights reserved.
55
#define LFLog(...) NSLog(__VA_ARGS__)
6-
/**
7-
文件中文说明
8-
1.Refresh Plugins After Xcode Upgrading
9-
每当Xcode升级之后,都会导致原有的Xcode插件不能使用,这是因为每个插件的Info.plist中记录了该插件兼容Xcode版本的DVTPlugInCompatibilityUUID,而每个版本的Xcode的DVTPlugInCompatibilityUUID都是不同的。如果想让原来的插件继续工作,我们就得将新版Xcode的DVTPlugInCompatibilityUUID加入到每一个插件的Info文件中,手动添加的话比较费时间还可能出错
10-
2.如何解决和使用本命令
11-
com + R 运行后,重启Xcode即可
12-
tips : Xcode重启后会要求用户确认是否加载非苹果官方插件,请选择Load Bundles
13-
14-
Documents in English
15-
16-
1.Whenever the Xcode after upgrading, will cause the original Xcode can not use the plugin, this is because each plugin Info. The records in the plist DVTPlugInCompatibilityUUID Xcode version of the plugin compatibility, and each version of Xcode DVTPlugInCompatibilityUUID is different.If you want to keep the original plug-in work, we will have the new Xcode DVTPlugInCompatibilityUUID added to each plugin Info file, manually add more time-consuming they might be wrong.
17-
18-
2. How to solve and use this commandCom + R running, restartXcode.
19-
Tips:reboot Xcode will require the user to confirm whether to Load the apple official plugin, please select the Load Bundles
20-
6+
/**
7+
* @author DragonLi
8+
* 如何解决和使用本命令
9+
* com + R 运行后,关闭Xcode再重启Xcode即可.
10+
* tips : Xcode重启后会要求用户确认是否加载非苹果官方插件,请选择Load Bundles
2111
*/
2212
#import <Foundation/Foundation.h>
2313

2414
int main(int argc, const char * argv[]) {
2515
@autoreleasepool {
26-
// 1.currentUsername
27-
NSString *currentUsername = NSUserName();
2816

29-
NSString *pluginPath = [NSString stringWithFormat:@"/Users/%@/Library/Application Support/Developer/Shared/Xcode/Plug-ins", currentUsername];
30-
// 2. 加载本地的Info.plist.
17+
/**
18+
* 获取当前电脑Users下所有文件名
19+
*/
20+
NSMutableArray* array = [NSMutableArray arrayWithCapacity:1];
21+
22+
NSFileManager* fileManager = [NSFileManager defaultManager];
23+
24+
NSString *tempString = @"/Users";
25+
26+
NSArray* tempArray = [fileManager contentsOfDirectoryAtPath:tempString error:nil];
27+
28+
for (NSString* fileName in tempArray) {
29+
30+
BOOL flag = YES;
31+
32+
NSString* fullPath = [tempString stringByAppendingPathComponent:fileName];
33+
34+
if ([fileManager fileExistsAtPath:fullPath isDirectory:&flag]) {
35+
36+
if (!flag) {
37+
[array addObject:fullPath];
38+
}
39+
}
40+
}
41+
/**
42+
遍历 得到 目录名
43+
*/
44+
NSString *userCatalogueNameReally = [[NSString alloc]init];
45+
for (NSString *userCatalogueName in tempArray) {
46+
47+
if ([userCatalogueName isEqualToString:@".localized"] ||
48+
[userCatalogueName isEqualToString:@"Deleted Users"]||
49+
[userCatalogueName isEqualToString:@"Guest"]||
50+
[userCatalogueName isEqualToString:@"Shared"]) {
51+
}else {
52+
userCatalogueNameReally = userCatalogueName;
53+
LFLog(@"当前用户%@",userCatalogueNameReally);
54+
}
55+
56+
}
57+
/// -------------- 获取 Xcode 插件路径名---------------///
58+
NSString *pluginPath = [NSString stringWithFormat:@"/Users/%@/Library/Application Support/Developer/Shared/Xcode/Plug-ins", userCatalogueNameReally];
59+
60+
/// 加载本地的Info.plist.
3161
NSDictionary *xcodeInfoDictionary = [[NSDictionary alloc] initWithContentsOfFile:@"/Applications/Xcode.app/Contents/Info.plist"];
3262

63+
/// 获取 Xcode UUID
3364
NSString *xcodeUUID = xcodeInfoDictionary[@"DVTPlugInCompatibilityUUID"];
3465

35-
NSFileManager *fileManager = [NSFileManager defaultManager];
3666
NSError *error;
3767
NSArray *pathArray = [fileManager contentsOfDirectoryAtPath:pluginPath error:&error];
3868
if (!error) {
3969
for (NSString *xcpluginFileName in pathArray) {
4070
if ([xcpluginFileName hasSuffix:@".xcplugin"]) {
71+
LFLog(@"你安装了%@这个插件",[xcpluginFileName componentsSeparatedByString:@".xcplugin"].firstObject);
4172
NSString *pluginPlistPath = [NSString stringWithFormat:@"%@/%@/Contents/Info.plist", pluginPath, xcpluginFileName];
4273
NSDictionary *pluginInfoDictionary = [[NSDictionary alloc] initWithContentsOfFile:pluginPlistPath];
4374
NSMutableArray *supportedUUIDs = [NSMutableArray arrayWithArray:pluginInfoDictionary[@"DVTPlugInCompatibilityUUIDs"]];
@@ -54,7 +85,12 @@ int main(int argc, const char * argv[]) {
5485
else{
5586
LFLog(@"Wrong path,Please try again!");
5687
}
88+
return 0;
5789
}
58-
59-
return 0;
6090
}
91+
92+
93+
94+
95+
96+

lastPic.png

428 KB
Loading

0 commit comments

Comments
 (0)