Skip to content

Commit

Permalink
Merge pull request #29 from Prayag2/bug_fix
Browse files Browse the repository at this point in the history
Fixed a bug
  • Loading branch information
Prayag2 authored Mar 13, 2021
2 parents 1be054c + fe06eee commit 51fbb82
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 13 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- ``CHANGELOG.md`` file with (Keep a Changelog)[https://keepachangelog.com/en/1.0.0/] format.

## [1.1.7] - 2021-03-13
### Fixes
- Fixed [#28](https://github.com/Prayag2/konsave/issues/28)

## Changes
- The program will now quit on any error


## [1.1.6] - 2021-03-11
### Changes
- Changed code style to [PEP8](https://www.python.org/dev/peps/pep-0008/)
Expand Down
Binary file modified konsave/__pycache__/funcs.cpython-39.pyc
Binary file not shown.
24 changes: 12 additions & 12 deletions konsave/funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
## IMPORT ##
import os
import shutil
import sys
import configparser
from random import shuffle
from zipfile import is_zipfile, ZipFile
Expand Down Expand Up @@ -43,6 +44,7 @@ def inner_func(*args, **kwargs):
function = func(*args, **kwargs)
except Exception as error:
print(f"Konsave: {error}\nTry 'konsave -h' for more info!")
sys.exit(0)
else:
return function

Expand Down Expand Up @@ -136,26 +138,24 @@ def copy(source, dest):
source: the source destination
dest: the destination to copy the file/folder to
"""
assert isinstance(source, str) and isinstance(dest, str), "Invalid path"
assert type(source) == str and type(dest) == str, "Invalid path"
assert source != dest, "Source and destination can't be same"
assert os.path.exists(source), "Source path doesn't exist"

if not os.path.exists(dest):
os.mkdir(dest)

if os.path.isdir(source):
for item in os.listdir(source):
source_path = os.path.join(source, item)
dest_path = os.path.join(dest, item)
for item in os.listdir(source):
source_path = os.path.join(source, item)
dest_path = os.path.join(dest, item)

if os.path.isdir(source_path):
copy(source_path, dest_path)
else:
if os.path.exists(dest_path):
os.remove(dest_path)
if os.path.isdir(source_path):
copy(source_path, dest_path)
else:
if os.path.exists(dest_path):
os.remove(dest_path)
if os.path.exists(source_path):
shutil.copy(source_path, dest)
else:
shutil.copy(source, dest)


# LIST PROFILES
Expand Down
2 changes: 1 addition & 1 deletion konsave/vars.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@
length_of_lop = len(list_of_profiles)

# Current Version
VERSION = "1.1.6"
VERSION = "1.1.7"

0 comments on commit 51fbb82

Please sign in to comment.