check if dir exists before creating
This commit is contained in:
parent
6509900227
commit
e1e6d2248f
|
@ -77,13 +77,13 @@ class Album < ActiveRecord::Base
|
||||||
private
|
private
|
||||||
|
|
||||||
def create_folders
|
def create_folders
|
||||||
Dir.mkdir( APP_CONFIG[:photos_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 )
|
Dir.mkdir( APP_CONFIG[:thumbs_path] + self.path ) if !Dir.exists?( APP_CONFIG[:photos_path] + self.path )
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy_folders
|
def destroy_folders
|
||||||
#puts "DELETE DIRECTORY " + APP_CONFIG[:photos_path] + self.path
|
#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[:thumbs_path] + self.path ) if Dir.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[:photos_path] + self.path ) if Dir.exists?( APP_CONFIG[:photos_path] + self.path )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue