Skip to content

Commit

Permalink
feat: check if source and destination dirs are valid at start of run
Browse files Browse the repository at this point in the history
  • Loading branch information
roryai committed Jan 9, 2024
1 parent 8928fc0 commit 318fcdd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 0 additions & 2 deletions app/app_controller.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from app.directory_manager import DirectoryManager
from app.file_factory import FileFactory
from app.file_gateway import FileGateway
from app.scanner import Scanner
Expand All @@ -10,7 +9,6 @@
class AppController:

def __init__(self, destination_directory, source_directory):
DirectoryManager().check_if_directory_exists(source_directory)
self.source_directory = source_directory
self.destination_directory = destination_directory

Expand Down
4 changes: 4 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from app.app_controller import AppController
from app.db_initializer import DBInitializer
from app.directory_manager import DirectoryManager
from app.extension_scanner import ExtensionScanner
from app.logger import Logger

Expand All @@ -21,8 +22,11 @@
DBInitializer().init_prod_database()

if args.extensions:
DirectoryManager().check_if_directory_exists(args.source)
ExtensionScanner(args.source).display_invalid_extensions()
elif args.destination:
DirectoryManager().check_if_directory_exists(args.source)
DirectoryManager().check_if_directory_exists(args.destination)
Logger().init_log_file(args.destination)
AppController(destination_directory=args.destination,
source_directory=args.source).copy_files_from_source_to_destination()
Expand Down

0 comments on commit 318fcdd

Please sign in to comment.