Exemple #1
0
  ret = False
  if Common.is_windows() :
    ret = path.endswith(".exe") or path.endswith(".bat") or or path.endswith(".ps1") or or path.endswith(".vbs")
  else :
    stinfo = os.stat(path)
    ret = stinfo.st_mode & S_IXUSR
  return ret

# path を テーブル Apps に挿入する。
def insertToApps(path) :
  title = fs.getFileName(path)
  platform = "linux"
  if Common.is_windows() :
    platform = "windows"
  sql = f"INSERT INTO Apps VALUES(NULL, '{title}', '{path}', '', '{platform}', '', '', CURRENT_DATE())"
  mysql.execute(sql)
  return

# START Program
settings = fs.readJson(fs.getCurrentDirectory() + '/InsApps.json')
binfolder = settings["binfolder"]

mysql = my.MySQL()

files = fs.listFiles2(binfolder)
for f in files :
  if isExecutable(f) :
    print(f)
    insertToApps(f)

print("終わり。")
Exemple #2
0
    fileName = Common.readline("対象のファイル・フォルダを指定してください。> ")
    print(INTERPRETERS)
    interpreterNo = int(Common.readline("番号を選択してください。> "))
else:
    fileName = Common.args(0)
    interpreterNo = int(Common.args(1))

interpreterLines = INTERPRETERS.split('\n')
interpreter = Text.substring(interpreterLines[interpreterNo - 1], 3)
print(interpreter + " が " + fileName + " に適用されます。")
a = Common.readline("実行しますか? (y/n)")
if a != 'y':
    Common.stop(9, "実行が取り消されました。")

# インタプリタ適用
if fs.isFile(fileName):
    apply(fileName, interpreter)
else:
    files = fs.listFiles2(fileName)
    for f in files:
        print(f)
        ext = fs.getExtension(f)
        if ext == ".cgi":
            apply(f, interpreter)
        else:
            print("Skipped")
        # end if
    # end for

print("正常終了。")