From ec831014e5329683016a679220afb1b59028031b Mon Sep 17 00:00:00 2001 From: "konstantin.grabar" Date: Mon, 31 Oct 2011 11:44:37 +0400 Subject: [PATCH] [refs #2161] Small changes into platform interface --- app/models/platform.rb | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/app/models/platform.rb b/app/models/platform.rb index 74e1c11e5..d14451396 100644 --- a/app/models/platform.rb +++ b/app/models/platform.rb @@ -87,6 +87,18 @@ class Platform < ActiveRecord::Base ActiveSupport::Notifications.instrument "event_log.observer", :object => self, :message => I18n.t("activerecord.attributes.platform.visibility_types.#{visibility}") end + + def add_downloads_symlink + #raise "Personal platform path #{ symlink_downloads_path } already exists!" if File.exists?(symlink_downloads_path) && File.directory?(symlink_downloads_path) + return true if File.exists?(symlink_downloads_path) && File.directory?(symlink_downloads_path) + FileUtils.symlink path, symlink_downloads_path + end + + def remove_downloads_symlink + #raise "Personal platform path #{ symlink_downloads_path } does not exists!" if !(File.exists?(symlink_downloads_path) && File.directory?(symlink_downloads_path)) + return true if !(File.exists?(symlink_downloads_path) && File.directory?(symlink_downloads_path)) + FileUtils.rm_rf symlink_downloads_path + end protected @@ -153,18 +165,6 @@ class Platform < ActiveRecord::Base def symlink_downloads_path "#{ DOWNLOADS_PATH }/#{ self.unixname }" end - - def add_downloads_symlink - #raise "Personal platform path #{ symlink_downloads_path } already exists!" if File.exists?(symlink_downloads_path) && File.directory?(symlink_downloads_path) - return true if File.exists?(symlink_downloads_path) && File.directory?(symlink_downloads_path) - FileUtils.symlink path, symlink_downloads_path - end - - def remove_downloads_symlink - #raise "Personal platform path #{ symlink_downloads_path } does not exists!" if !(File.exists?(symlink_downloads_path) && File.directory?(symlink_downloads_path)) - return true if !(File.exists?(symlink_downloads_path) && File.directory?(symlink_downloads_path)) - FileUtils.rm_rf symlink_downloads_path - end def make_owner_rel add_owner owner