lib/openwfe/contextual.rb in openwferu-0.9.12 vs lib/openwfe/contextual.rb in openwferu-0.9.12.863

- old
+ new

@@ -85,8 +85,29 @@ end s end + # + # Returns the work directory for the OpenWFE[ru] application context + # (if any). + # + def get_work_directory (context_or_dir=nil) + + dir = if context_or_dir.is_a?(String) + context_or_dir + elsif context_or_dir.respond_to?(:[]) + context_or_dir[:work_directory] + else + @application_context[:work_directory] if @application_context + end + + dir = DEFAULT_WORK_DIRECTORY unless dir + + FileUtils.makedirs(dir) unless File.exist?(dir) + + dir + end + end end