check if dir exists before creating
This commit is contained in:
parent
6509900227
commit
e1e6d2248f
1 changed files with 4 additions and 4 deletions
|
@ -77,13 +77,13 @@ class Album < ActiveRecord::Base
|
|||
private
|
||||
|
||||
def create_folders
|
||||
Dir.mkdir( APP_CONFIG[:photos_path] + self.path )
|
||||
Dir.mkdir( APP_CONFIG[:thumbs_path] + self.path )
|
||||
Dir.mkdir( APP_CONFIG[:photos_path] + self.path ) if !Dir.exists?( APP_CONFIG[:photos_path] + self.path )
|
||||
Dir.mkdir( APP_CONFIG[:thumbs_path] + self.path ) if !Dir.exists?( APP_CONFIG[:photos_path] + self.path )
|
||||
end
|
||||
|
||||
def destroy_folders
|
||||
#puts "DELETE DIRECTORY " + APP_CONFIG[:photos_path] + self.path
|
||||
Dir.delete( APP_CONFIG[:thumbs_path] + self.path ) if File.exists?( APP_CONFIG[:thumbs_path] + self.path )
|
||||
Dir.delete( APP_CONFIG[:photos_path] + self.path ) if File.exists?( APP_CONFIG[:photos_path] + self.path )
|
||||
Dir.delete( APP_CONFIG[:thumbs_path] + self.path ) if Dir.exists?( APP_CONFIG[:thumbs_path] + self.path )
|
||||
Dir.delete( APP_CONFIG[:photos_path] + self.path ) if Dir.exists?( APP_CONFIG[:photos_path] + self.path )
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue