Merge branch 'master' into crypt
This commit is contained in:
commit
0b8a805e71
1 changed files with 18 additions and 13 deletions
|
@ -68,19 +68,8 @@ class Crypto(object):
|
||||||
Decrypt and decompress the project files
|
Decrypt and decompress the project files
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# If project hasn't been encrypted before,
|
# Decrypt and decompress the project if crypt_file exists
|
||||||
# setup crypt working directory
|
if os.path.isfile(self.config.crypt_file):
|
||||||
if not os.path.isfile(self.config.crypt_file):
|
|
||||||
os.mkdir(self.config.crypt_dir)
|
|
||||||
|
|
||||||
project_files = self.config.get_project_files()
|
|
||||||
for pf in project_files:
|
|
||||||
shutil.copy2(pf, self.config.crypt_dir)
|
|
||||||
os.chdir(self.config.crypt_dir)
|
|
||||||
return True
|
|
||||||
|
|
||||||
# Otherwise, decrypt and decompress the project
|
|
||||||
else:
|
|
||||||
cf = self.config.crypt_file
|
cf = self.config.crypt_file
|
||||||
sl = self.config.salt_len
|
sl = self.config.salt_len
|
||||||
crl = os.path.getsize(cf) - sl
|
crl = os.path.getsize(cf) - sl
|
||||||
|
@ -116,6 +105,22 @@ class Crypto(object):
|
||||||
|
|
||||||
os.chdir(self.config.crypt_dir)
|
os.chdir(self.config.crypt_dir)
|
||||||
return True
|
return True
|
||||||
|
# If project exited before encrypting the working directory
|
||||||
|
# change to the working directory to resume the session
|
||||||
|
elif os.path.isdir(self.config.crypt_dir):
|
||||||
|
os.chdir(self.config.crypt_dir)
|
||||||
|
return True
|
||||||
|
# If project hasn't been encrypted before,
|
||||||
|
# setup crypt working directory
|
||||||
|
else:
|
||||||
|
os.mkdir(self.config.crypt_dir)
|
||||||
|
|
||||||
|
project_files = self.config.get_project_files()
|
||||||
|
for pf in project_files:
|
||||||
|
shutil.copy2(pf, self.config.crypt_dir)
|
||||||
|
os.chdir(self.config.crypt_dir)
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
def confirm_password_retry(self):
|
def confirm_password_retry(self):
|
||||||
answer = raw_input("Re-enter your password? (y/n): ").strip()
|
answer = raw_input("Re-enter your password? (y/n): ").strip()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue