leitwolf / QuickXDev

Powerful quick-cocos2d-x develop plugin for sublime text 2/3
162 stars 100 forks source link

用quick-cocos2d-x git上的代码时,sublime text 创建工程(Create New Project)时,创建不了。 #1

Open sue602 opened 10 years ago

sue602 commented 10 years ago

需要修改 Packages/QuickXDev/quickx.py 这个文件,详情见 ###### 这个备注

class QuickxCreateNewProjectCommand(sublime_plugin.WindowCommand): def run(self, dirs): quick_cocos2dx_root = checkRoot() if not quick_cocos2dx_root: return cmdPath="" if sublime.platform()=="osx": cmdPath=quick_cocos2dx_root+"/bin/create_project.sh" elif sublime.platform()=="windows": cmdPath=quick_cocos2dx_root+"/bin/create_project.bat" if cmdPath=="" or not os.path.exists(cmdPath): sublime.error_message("command no exists") return self.cmdPath=cmdPath self.window.run_command("hide_panel") packageName="com.mygames.game01" on_done = functools.partial(self.on_done, dirs[0]) v = self.window.show_input_panel( "Package Name:", packageName, on_done, None, None) v.sel().clear() v.sel().add(sublime.Region(0, len(packageName)))

def on_done(self, path, packageName):
    if packageName=="":
        sublime.error_message("PackageName must not empty!")
        return
    dotIndex=packageName.rfind(".")
    if dotIndex==-1:
        sublime.error_message("PackageName must two levels,i.e. 'com.game01'.")
        return
    dirName=packageName[dotIndex+1:]
    for item in os.listdir(path):
        if item==dirName:
            sublime.error_message("Folder '%s' already exists."%(dirName))
            return
    args=[self.cmdPath," -p ",packageName]  ######此处增加 -p 即可解决
    if sublime.platform()=="osx":
        subprocess.Popen(args,cwd=path)
    elif sublime.platform()=="windows":
        child=subprocess.Popen(args,cwd=path)
        child.wait()
        self.window.run_command("refresh_folder_list")

def is_enabled(self, dirs):
    return len(dirs)==1

def is_visible(self, dirs):
    return self.is_enabled(dirs)
leitwolf commented 10 years ago

这个之前有人反映过,不过现在没出正式的包,所以暂不更新。不然会影响很多的人。公司里用的一用都是正式版的,不可能随时的check out代码。所以,这个问题,抱歉了,要先等等。 目前的解决方法是:sublime2的话可以自己改,3的话要自己下载来再改(sublime3 package control下截的是一个压缩包)。