import os
from subprocess import Popen, PIPE
class 雷电命令:
def __init__(self):
os.putenv('Path', self.save_dir())
def save_dir(self):
with open('dir','a+') as p:
p.read()
with open('dir', 'r+') as p:
a = p.read()
if len(a) == 0:
b = self.get_dir()
p.write(b)
a = b
return a
def get_dir(self):
path_list = ['C:\\', 'D:\\', 'E:\\', 'F:\\']
for path in path_list:
for root, dirs, files, in os.walk(path):
for f in files:
if f == 'ldcon