Skip to content

Commit

Permalink
Solara
Browse files Browse the repository at this point in the history
  • Loading branch information
IdeaS0ft committed Sep 20, 2024
1 parent 1169368 commit 6a6ce6f
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 7 deletions.
3 changes: 2 additions & 1 deletion solara/lib/core/brands/brand_onboarder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ def clone_brand
Solara.logger.debug("Cloning #{@clone_brand_key} to #{@brand_key}")
source = FilePath.brand(@clone_brand_key)
destination = FilePath.brand(@brand_key)
FileUtils.rm_rf(destination) if File.exist?(destination)

FileManager.delete_if_exists(destination)
FolderCopier.new(source, destination).copy
end

Expand Down
2 changes: 1 addition & 1 deletion solara/lib/core/brands/brands_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def offboard(brand_key)
if index
brand_dir = FilePath.brand(brand_key)
remove_brand(index)
FileUtils.rm_rf(brand_dir)
FileManager.delete_if_exists(brand_dir)
save_brands_list
Solara.logger.debug("Brand removed.")
else
Expand Down
2 changes: 1 addition & 1 deletion solara/lib/core/scripts/directory_creator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def self.create_directories(directories, delete_if_exists = false)
def self.create_directory(dir, delete_if_exists)
if Dir.exist?(dir)
if delete_if_exists
FileUtils.rm_rf(dir)
FileManager.delete_if_exists(dir)
Solara.logger.debug("🧹 Deleted directory: #{dir}")
Dir.mkdir(dir)
end
Expand Down
6 changes: 4 additions & 2 deletions solara/lib/core/scripts/file_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@ def copy_files_recursively(source_dir, destination_dir)

def delete_folders_by_prefix(directory, folder_prefix)
# Get a list of all folders in the directory
folders = Dir.entries(directory).select { |entry| File.directory?(File.join(directory, entry)) && entry.start_with?(folder_prefix) }
folders = Dir.entries(directory).select { |entry|
File.directory?(File.join(directory, entry)) && entry.start_with?(folder_prefix)
}

# Delete each folder
folders.each do |folder|
folder_path = File.join(directory, folder)
FileUtils.rm_rf(folder_path)
FileManager.delete_if_exists(folder_path)
Solara.logger.debug("🧹 Deleted folder: #{folder_path}")
end
end
Expand Down
2 changes: 1 addition & 1 deletion solara/lib/core/scripts/platform/ios/infoplist_switcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def copy_string_catalog
# Remove from project before copying
project_infoplist_string_catalog = FilePath.project_infoplist_string_catalog
if File.exist?(project_infoplist_string_catalog)
FileUtils.rm_rf(project_infoplist_string_catalog)
FileManager.delete_if_exists(project_infoplist_string_catalog)
Solara.logger.debug("Deleted #{project_infoplist_string_catalog} successfully.")
end

Expand Down
2 changes: 1 addition & 1 deletion solara/lib/solara_initializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def confirm_init_if_necessary
Solara.logger.info("Solara initialization cancelled.")
exit 1
end
FileUtils.rm_rf(brand_path)
FileManager.delete_if_exists(brand_path)
end
end

Expand Down

0 comments on commit 6a6ce6f

Please sign in to comment.