2011-01-20 17 views
9

मुझे ऐप्पलस्क्रिप्ट के साथ एक्सकोड परियोजनाओं में फ़ोल्डर कॉपी करने में कुछ परेशानी हो रही है। एप्पलस्क्रिप्ट के बिना मैं फ़ोल्डर को एक्सकोड में खींचता हूं।सेबस्क्रिप्ट एक्सकोड में फ़ोल्डरों की प्रतिलिपि बनाने के लिए?

मैंने फ़ाइल प्रकार के लिए "wrapper.library" का उपयोग करके एक्सकोड में पुस्तकालयों की प्रतिलिपि बनाने के लिए नीचे दिखाए गए एक जैसा एप्पलस्क्रिप्ट हैंडलर का उपयोग किया है। नीचे मैं एक्सकोड में फ़ोल्डर की प्रतिलिपि बनाने का प्रयास करने के लिए "wrapper.folder" का उपयोग कर रहा हूं और यह काम नहीं कर रहा है।

on addFolder(fname, fpath) 
    tell application "Xcode" 
    tell project "Unity-iPhone" 
    set my_targets to targets 
    set s_target to item 1 of my_targets 
    set compile_phase to compile sources phase of s_target 
    set link_phase to get link binary with libraries phase of s_target 
    tell root group 
    set a to make new file reference with properties {full path:fpath & fname, name:fname, file type:"wrapper.folder"} 
    add a to link_phase 
    end tell 
    end tell 
    end tell 
    end addFolder 

किसी को क्या हो रहा है या गुम कैसे XCode में एक फ़ोल्डर की प्रतिलिपि करने के लिए एक Apple स्क्रिप्ट लिखने के लिए कर रहा हूँ किसी भी विचार है?

+0

मुझे यह जानकर उत्सुकता है कि आपने इस समस्या को कैसे हल किया ... –

+0

यह एक्सकोड प्लगइन मदद कर सकता है: https://github.com/larsxschneider/Xcode-Scripting-Interface –

+1

मुझे कभी भी हल करने के अलावा कोई समाधान नहीं मिला है फ़ोल्डर मैन्युअल रूप से। मुझे पता है कि यह किया जा सकता है, क्योंकि मैंने संकलित एप्पलस्क्रिप्ट का उपयोग किया है जो फ़ोल्डर को स्थानांतरित कर सकता है। –

उत्तर

1

यह मेरे लिए काम कर रहा है:

--this is for xcode 3.x 
tell application "Xcode" 
    tell active project document 
     tell root group 
      --Note: Large folders make it seems that the script is hanging. Give it some time to list all items in the given folder. 
      make new file reference with properties {name:"My Desktop Folder", full path:(POSIX path of (path to desktop folder)), file type:"wrapper.folder"} 
     end tell 
    end tell 
end tell 

Xcode 4 के लिए कोड पर कुछ भिन्न है

--this is for Xcode 4.x 
tell application "Xcode" 
    tell project 1 
     tell root group 
      --Note: big folders make it seems that the application (not the script like in Xcode 3) is hanging. Give it some time to list all items in the given folder. 
      make new file reference with properties {name:"My Desktop Folder", full path:(POSIX path of (path to desktop folder)), file kind:"folder"} 
     end tell 
    end tell 
end tell 

विकल्प 'गंतव्य फ़ोल्डर में कॉपी यदि आवश्यक हो तो सिर्फ परियोजना के लिए फ़ाइलों की प्रतिलिपि (यदि वे पहले से वहां नहीं हैं) और फिर मूल फ़ाइलों की बजाय कॉपी की गई फ़ाइलों का फ़ाइल संदर्भ बनाते हैं। आप फाइंडर या सीएल या डिटो जैसे शेल कमांड के साथ ऐसा ही कर सकते हैं, फिर कॉपी की गई फ़ाइलों का संदर्भ लें। तो मैं इसके बजाय पूर्ण पथ लेकिन सापेक्ष पथ का उपयोग नहीं करता। परियोजना को दूसरे फ़ोल्डर में ले जाने वाले सापेक्ष पथ आपको कोई समस्या नहीं देंगे।

+0

दिलचस्प। यह परियोजना के लिए एक फ़ोल्डर फ़ाइल संदर्भ जोड़ता है। (ध्यान दें कि फ़ोल्डर आइकन नीला है, पीला नहीं है।) हालांकि, इन फ़ाइलों को परियोजना के निर्माण या प्रति चरण में जोड़ा नहीं गया है। – ThomasW

संबंधित मुद्दे