add rebuild the status of filefield in the mongo.

fix the problem about copying dir when lacking that dir.
This commit is contained in:
chiu committed 2019-10-28 21:39:32 +08:00
1 parent fcfcd7d058
commit ae85fe2859
3 files changed
+18 -1

No files matched your search

+6
View File
@@ -74,6 +74,9 @@ class Filefield
FileUtils.cd('..')
@back_foler = file_name.dup #very important,don't just use '=',it will change original value when it change
@back_foler[-1] = "_back/."
if !Dir.exist?(file_name)
FileUtils.mkdir_p file_name
end
FileUtils.cp_r(@back_foler, file_name)
end
end
@@ -82,6 +85,9 @@ class Filefield
if (file_name.include? "/") == false
FileUtils.cp(file_name , dest_file_path)
else
if !Dir.exist?(dest_file_path)
FileUtils.mkdir_p dest_file_path
end
FileUtils.cp_r(file_name , dest_file_path+'..')
end
end