mirror of
https://github.com/zhigang1992/RubyMotion.git
synced 2026-04-07 09:37:36 +08:00
if build_dir can't be created, use a temporary directory instead
This commit is contained in:
@@ -37,8 +37,8 @@ module Motion; module Project
|
||||
@frameworks = ['UIKit', 'Foundation', 'CoreGraphics']
|
||||
@delegate_class = 'AppDelegate'
|
||||
@name = 'Untitled'
|
||||
@build_dir = File.join(project_dir, 'build')
|
||||
@resources_dir = File.join(project_dir, 'resources')
|
||||
@build_dir = File.join(project_dir, 'build')
|
||||
@device_family = :iphone
|
||||
@bundle_signature = '????'
|
||||
@interface_orientations = [:portrait, :landscape_left, :landscape_right]
|
||||
@@ -72,6 +72,23 @@ module Motion; module Project
|
||||
end
|
||||
end
|
||||
|
||||
def build_dir
|
||||
tried = false
|
||||
begin
|
||||
FileUtils.mkdir_p(@build_dir)
|
||||
rescue Errno::EACCES
|
||||
raise if tried
|
||||
require 'digest/sha1'
|
||||
hash = Digest::SHA1.hexdigest(File.expand_path(project_dir))
|
||||
tmp = File.join(ENV['TMPDIR'], hash)
|
||||
$stderr.puts "Cannot create build_dir `#{@build_dir}'. Check the permissions. Using temporary build directory instead: `#{tmp}'"
|
||||
@build_dir = tmp
|
||||
tried = true
|
||||
retry
|
||||
end
|
||||
@build_dir
|
||||
end
|
||||
|
||||
attr_reader :project_dir
|
||||
|
||||
def project_file
|
||||
|
||||
Reference in New Issue
Block a user