Permalink
Browse files

tweaks to filesystem and added $design_mode

  • Loading branch information...
1 parent c1b70b5 commit 66e05e6a95152cf313fb593aef3521c110fa3913 @onkis onkis committed with Charles Jolley Feb 20, 2010
Showing with 11 additions and 5 deletions.
  1. +5 −2 lib/sproutcore/rack/builder.rb
  2. +6 −3 lib/sproutcore/rack/filesystem.rb
@@ -89,11 +89,14 @@ def call(env)
project_mutex.synchronize do
did_reload = reload_project! # if needed
-
+
# collect some standard info
url = env['PATH_INFO']
url = '/sproutcore/welcome' if url == '/'
-
+
+ #designer mode?
+ $design_mode = true if /designMode=YES/ =~ env['QUERY_STRING']
+ SC.logger.info $design_mode
# look for a matching target
target = target_for(url)
ret = not_found("No matching target") if target.nil?
@@ -102,25 +102,28 @@ def call(env)
def list_files(original_path)
results = []
+ @id = 0
with_sanitized_path(original_path) do |root_path|
results = folder_contents(root_path, root_path)
end
success(results.to_json)
end
def folder_contents(dir, root_path)
- results = [];
+ results = []
+
Dir.new(dir).each do |path|
name = path
path = dir + path
sc_path = path.gsub(root_path,"")
sc_path = sc_path.gsub(name,"")
if FileTest.directory?(path)
if not (File.basename(path)[0] == ?. or @ignore_directories.include?(File.basename(path)))
- results<< {:type => :dir, :dir => sc_path, :name =>name, :contents=> folder_contents(path+"/", root_path)}
+ results<< {:type => :Dir, :dir => sc_path, :name =>name,
+ :contents=> folder_contents(path+"/", root_path), :id => @id+=1}
end
else #just a regular file
- results<< {:type => :file, :dir => sc_path, :name => name}
+ results<< {:type => :File, :dir => sc_path, :name => name, :id => @id+=1 }
end
end
return results

0 comments on commit 66e05e6

Please sign in to comment.