lib/run_loop/device.rb in run_loop-2.4.1 vs lib/run_loop/device.rb in run_loop-2.5.0
- old
+ new
@@ -312,14 +312,32 @@
File.join(simulator_root_dir, 'device.plist')
end.call
end
# @!visibility private
- def simulator_global_preferences_path
- @simulator_global_preferences_path ||= lambda do
- return nil if physical_device?
- File.join(simulator_root_dir, "data/Library/Preferences/.GlobalPreferences.plist")
- end.call
+ def simulator_global_preferences_path(timeout=10)
+ return nil if physical_device?
+
+ path = File.join(simulator_root_dir,
+ "data/Library/Preferences/.GlobalPreferences.plist")
+
+ return path if File.exist?(path)
+
+ start = Time.now
+ while !File.exist?(path) && (start + timeout) < Time.now
+ sleep(1.0)
+ end
+
+ return path if File.exist?(path)
+
+ raise(RuntimeError, %Q[
+Timed out waiting for .GlobalPreferences.plist after #{Time.now - start} seconds.
+
+File does not exist at path:
+
+#{path}
+
+])
end
# @!visibility private
# In megabytes
def simulator_size_on_disk