Добавлен перенос файлов кроме иконок из директории ~/.Desktop в директорию ~/Home/Moved

git-svn-id: http://svn.calculate.ru/calculate2/calculate-client/trunk@1627 c91db197-33c1-4113-bf15-f8a5c547ca64
develop
asamoukin 15 years ago
parent 48eb8ebc68
commit df19fe2c96

@ -862,10 +862,10 @@ conjunction with the 'login' or 'logout'")
killPid.append(process.split(" ")[0])
if "--login" in process and "cl-sync" in process:
killPid.append(process.split(" ")[0])
strPid = str(os.getpid())
# удалим свой pid из списка завершаемых процессов
if strPid in killPid:
killPid.remove(strPid)
strPid = str(os.getpid())
# удалим свой pid из списка завершаемых процессов
if strPid in killPid:
killPid.remove(strPid)
if killPid and " ".join(killPid).strip():
textLine = self.execProg("kill -9 %s" %" ".join(killPid))
if not (textLine == None):
@ -1986,6 +1986,19 @@ or ld_bind_dn or ld_bind_pw")
os.unlink(fd)
else:
filesDir.append(fd)
# Нахождение файлов отличных от иконок в Desktop
pathDesktop = './Desktop'
filesDirDesk = []
if os.path.exists(pathDesktop):
filesAndDirDesk = map(lambda x, os.path.join(pathDesktop,x),\
filter(lambda x,not x.rpartition('.')[2]=='desktop',\
os.listdir(pathDesktop)))
for fd in filesAndDirDesk:
if os.path.islink(fd):
os.unlink(fd)
else:
filesDirDesk.append(fd)
if not filesDir or not os.path.exists("Home"):
# Удаляем пустую папку Moved
if os.path.exists(movedPath) and not os.listdir(movedPath):
@ -1996,6 +2009,29 @@ or ld_bind_dn or ld_bind_pw")
return True
if not os.path.exists(movedPath):
os.mkdir(movedPath)
# Перенос файлов из Desktop в Moved
movedPathDesk = os.path.join(movedPath, pathDesktop)
if filesDirDesk:
# Создаем директорию есле она не существует
if not os.path.exists(movedPathDesk):
os.mkdir(movedPathDesk)
for fd in filesDirDesk:
execStr = "cp -r '%s' '%s'" %(fd, movedPathDesk)
textLine = self.execProg(execStr)
if not (textLine == None):
self.printERROR(_("Can not exec") + " " + str(execStr) +\
" ...")
return False
execStr = "rm -rf '%s'" %fd
textLine = self.execProg(execStr)
if not (textLine == None):
self.printERROR(_("Can not exec") + " " + str(execStr) +\
" ...")
return False
else:
# Удаляем пустую папку Desktop
if os.path.exists(movedPathDesk) and not os.listdir(movedPathDesk):
os.rmdir(movedPathDesk)
directFile = os.path.join(movedPath,".directory")
if not os.path.exists(directFile):
txt = "[Desktop Entry]\nIcon=folder-development"

Loading…
Cancel
Save