2012-10-15 3 views

답변

1

참고 : 이것은 유용한 해결책은 아니지만 여기에서 계속 진행할 수 있기를 바랍니다.

this question에서 언급 한 바와 같이

, OSX의 파일 형식 연결은 plist 파일에 저장, 그래서 나는 특정 디렉토리 아래의 모든 plists에 문자열 hpp 검색 짧은 쉘 스크립트 작성됩니다

#!/bin/sh 

find $1 -iname "*.plist" -print0 | while read -d $'\0' file 
do 
    if plutil -convert xml1 "$file" -r -o - | grep -q "<string>hpp</string>" 
    then 
    echo "$file" 
    fi 
done 

호출을 sh find_hpp.sh /Applications/Xcode.app으로 위의 스크립트는 예상대로 Contents/Info.plist을 찾습니다. 이 파일은 Xcode가 실행 중일 때 잠겨 있기 때문에 Xcode로 직접 편집 할 수는 없지만 Xcode를 종료하고 plutil -convert xml1 Info.plist -o Info.xml을 통해 이진 plist 파일을 xml로 변환하고 xml을 편집 한 다음 plutil -convert binary1 Info.xml -o Info.plist으로 다시 변환 할 수 있습니다.

난 그냥 xml 파일에서 hpp을 검색하고 (이 두 번 발생) 추가 파일 형식으로 ipp을 추가 :

<dict> 
     <key>CFBundleTypeExtensions</key> 
     <array> 
       <string>hh</string> 
       <string>hp</string> 
       <string>hpp</string> 
       <string>hxx</string> 
       <string>h++</string> 
       <string>ipp</string> 
     </array> 
     <key>CFBundleTypeIconFile</key> 
     <string>c-header_Icon</string> 
     <key>CFBundleTypeName</key> 
     <string>C++ Header Source</string> 
     <key>CFBundleTypeRole</key> 
     <string>Editor</string> 
     <key>LSIsAppleDefaultForType</key> 
     <true/> 
     <key>LSItemContentTypes</key> 
     <array> 
       <string>public.c-plus-plus-header</string> 
     </array> 
</dict> 

을 다시 바이너리 편집 된 XML 파일을 변환 한 후, 실행 서비스를 강제로하는 것은 다시합니다 - plist를 읽은 후 앱 번들을 만졌습니다.

touch /Applications/Xcode.app 

로그 오프했지만 다시 로그온했지만 아무것도하지 않았습니다. Xcode에서 구문 강조 기능을 사용하지 않고 Finder에서 .ipp 파일의 파일 연결을 나타내지 않습니다. 심지어 시스템을 다시 시작하고 Xcode 앱 번들을 내 데스크톱으로 옮겼다. 아직 아무것도. 나는 다른 누군가가 여기에서 데려 오기를 바랍니다.

1
  1. sudo /Applications/Xcode.app/Contents/MacOS/Xcode /System/Library/CoreServices/CoreTypes.bundle/Contents/Info.plist

  2. 사용 Cmd를 + F.cpp을 찾아 .ipp 확장

  3. 재부팅

근처에 추가
관련 문제