lib/spotlight/query.rb in spotlight-0.0.4 vs lib/spotlight/query.rb in spotlight-0.0.5
- old
+ new
@@ -21,7 +21,20 @@
def execute
@md_query = MDQueryNative.new(query_string)
@md_query.set_search_scopes(@scopes)
@md_query.execute
end
+
+ def to_saved_search(filename)
+ obj = {
+ 'RawQuery' => query_string,
+ 'SearchCriteria' => {
+ 'FXScopeArrayOfPaths' => scopes
+ }
+ }
+
+ File.open(filename, 'w') do |file|
+ file.write(obj.to_plist)
+ end
+ end
end
end