def createShortcuts(lMeta): file_template = getAutogenFileTemplate() placeForScriptsThatOSHasPATHSetTo = data.pathExt() for meta in lMeta: fileContent = file_template fileContent = fileContent.replace('__py_file__', meta[0]) fileContent = fileContent.replace('__opt_cmd__', meta[2]) fileContent = fileContent.replace('__custom__', 'python3 %s $*' % meta[0]) fileOut = placeForScriptsThatOSHasPATHSetTo + "/" + meta[1] fileOut = os.path.normpath(fileOut) print( (meta, fileOut) ) fh = open(fileOut, 'w') fh.write(fileContent) fh.close() os.system('chmod +x %s' % fileOut)
_meta_shell_command = 'dr' import sys import os import argparse import platform try: from tkinter import Tk except: pass import dcore.data as data path_ext_folder = data.pathExt() cacheFile = os.path.join(data.dcoreData(), '%s.cache' % os.path.split(__file__)[1]) cacheFilePerimated = cacheFile + ".deleted" tempBatch = cacheFile + '.temp.bat' def rememberDirs(): dirs = [os.getcwd()] dirs += getFileContent() bad = [d for d in dirs if not os.path.isdir(d) and not (len(d.split(',')) == 2 and os.path.isdir(d.split(',')[1]))] print('Removing non-existent directories: %s.' % bad) dirs = [d for d in dirs if d not in bad] setFileContent( dirs )