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

Commit

Permalink
完善终结版本,更新说明
Browse files Browse the repository at this point in the history
1.修正后为不获取用户名,而是获取用户下个人目录方式
2.增加打印的说明截图
  • Loading branch information
DevDragonLi committed Mar 26, 2016
1 parent 5e47f7d commit c34f43f
Show file tree
Hide file tree
Showing 5 changed files with 100 additions and 26 deletions.
22 changes: 22 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
The MIT License (MIT)

Copyright (c) 2015 DragonLi

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

24 changes: 20 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
#XcodePluginUpgradeCompatible-LFL

## 特别说明,此版本为解决Xcode插件处理终结版本(只要是xcode版本升级,导致不插件无法加载,都可以尝试使用此工程命令修正,和xcode5之后版本无关),觉得好用,还望给个star ,谢谢呀

### 有群里小伙伴反馈,如果电脑的用户名曾经更改而且没有更改个人目录那么获取的路径无效,修正后为不获取用户名,而是获取用户下个人目录方式.并且打印台也打印一下你插件目录安装插件都是哪些啦.

##1.直接上图(很简单一步到位)

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

![Pic2](https://github.com/LFL2018/PicSources/blob/master/XcodePluginUpgradeCompatible-LFL/XcodePluginUpgradeCompatible-LFL2.png)
![frist_Pic](https://github.com/LFL2018/Som_related_information_LFL/blob/master/The_picture/XcodePluginUpgradeCompatible-LFL/XcodePluginUpgradeCompatible-LFL1.png?raw=true)


![Pic2](https://github.com/LFL2018/Som_related_information_LFL/blob/master/The_picture/XcodePluginUpgradeCompatible-LFL/XcodePluginUpgradeCompatible-LFL2.png?raw=true)

![Pic3](https://github.com/LFL2018/Som_related_information_LFL/blob/master/The_picture/XcodePluginUpgradeCompatible-LFL/XcodePluginUpgradeCompatible-LFL3.png?raw=true)

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

##2.1 中文说明

Expand All @@ -22,4 +31,11 @@

### 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

## 觉得好用,还望给个star ,谢谢呀

### 3. 有任何问题,请及时 issues me
<[email protected]>


## License

English: this library is available under the MIT license, see the LICENSE file for more information.
Binary file not shown.
80 changes: 58 additions & 22 deletions XcodePluginUpgradeCompatible-LFL/main.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,41 +3,72 @@
// Created by DragonLi on 15/12/18.
// Copyright © 2015年 DragonLi. All rights reserved.
#define LFLog(...) NSLog(__VA_ARGS__)
/**
文件中文说明
1.Refresh Plugins After Xcode Upgrading
每当Xcode升级之后,都会导致原有的Xcode插件不能使用,这是因为每个插件的Info.plist中记录了该插件兼容Xcode版本的DVTPlugInCompatibilityUUID,而每个版本的Xcode的DVTPlugInCompatibilityUUID都是不同的。如果想让原来的插件继续工作,我们就得将新版Xcode的DVTPlugInCompatibilityUUID加入到每一个插件的Info文件中,手动添加的话比较费时间还可能出错
2.如何解决和使用本命令
com + R 运行后,重启Xcode即可
tips : Xcode重启后会要求用户确认是否加载非苹果官方插件,请选择Load Bundles
Documents in English
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.
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
/**
* @author DragonLi
* 如何解决和使用本命令
* com + R 运行后,关闭Xcode再重启Xcode即可.
* tips : Xcode重启后会要求用户确认是否加载非苹果官方插件,请选择Load Bundles
*/
#import <Foundation/Foundation.h>

int main(int argc, const char * argv[]) {
@autoreleasepool {
// 1.currentUsername
NSString *currentUsername = NSUserName();

NSString *pluginPath = [NSString stringWithFormat:@"/Users/%@/Library/Application Support/Developer/Shared/Xcode/Plug-ins", currentUsername];
// 2. 加载本地的Info.plist.
/**
* 获取当前电脑Users下所有文件名
*/
NSMutableArray* array = [NSMutableArray arrayWithCapacity:1];

NSFileManager* fileManager = [NSFileManager defaultManager];

NSString *tempString = @"/Users";

NSArray* tempArray = [fileManager contentsOfDirectoryAtPath:tempString error:nil];

for (NSString* fileName in tempArray) {

BOOL flag = YES;

NSString* fullPath = [tempString stringByAppendingPathComponent:fileName];

if ([fileManager fileExistsAtPath:fullPath isDirectory:&flag]) {

if (!flag) {
[array addObject:fullPath];
}
}
}
/**
遍历 得到 目录名
*/
NSString *userCatalogueNameReally = [[NSString alloc]init];
for (NSString *userCatalogueName in tempArray) {

if ([userCatalogueName isEqualToString:@".localized"] ||
[userCatalogueName isEqualToString:@"Deleted Users"]||
[userCatalogueName isEqualToString:@"Guest"]||
[userCatalogueName isEqualToString:@"Shared"]) {
}else {
userCatalogueNameReally = userCatalogueName;
LFLog(@"当前用户%@",userCatalogueNameReally);
}

}
/// -------------- 获取 Xcode 插件路径名---------------///
NSString *pluginPath = [NSString stringWithFormat:@"/Users/%@/Library/Application Support/Developer/Shared/Xcode/Plug-ins", userCatalogueNameReally];

/// 加载本地的Info.plist.
NSDictionary *xcodeInfoDictionary = [[NSDictionary alloc] initWithContentsOfFile:@"/Applications/Xcode.app/Contents/Info.plist"];

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

NSFileManager *fileManager = [NSFileManager defaultManager];
NSError *error;
NSArray *pathArray = [fileManager contentsOfDirectoryAtPath:pluginPath error:&error];
if (!error) {
for (NSString *xcpluginFileName in pathArray) {
if ([xcpluginFileName hasSuffix:@".xcplugin"]) {
LFLog(@"你安装了%@这个插件",[xcpluginFileName componentsSeparatedByString:@".xcplugin"].firstObject);
NSString *pluginPlistPath = [NSString stringWithFormat:@"%@/%@/Contents/Info.plist", pluginPath, xcpluginFileName];
NSDictionary *pluginInfoDictionary = [[NSDictionary alloc] initWithContentsOfFile:pluginPlistPath];
NSMutableArray *supportedUUIDs = [NSMutableArray arrayWithArray:pluginInfoDictionary[@"DVTPlugInCompatibilityUUIDs"]];
Expand All @@ -54,7 +85,12 @@ int main(int argc, const char * argv[]) {
else{
LFLog(@"Wrong path,Please try again!");
}
return 0;
}

return 0;
}






Binary file added lastPic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit c34f43f

Please sign in to comment.