Sha256: 2fd30698cfcb7df7ced1eaf4f2fa246ef34324a83971e134a458d4098dfd3f46

Contents?: true

Size: 811 Bytes

Versions: 8

Compression:

Stored size: 811 Bytes

Contents

# encoding: utf-8

class File
	@@separator = nil
	def self.cygwin?
		RUBY_PLATFORM.downcase.include?('cygwin')
	end

	def self.separator
		return @@separator if @@separator
		# Return `backlash` for Cygwin and Windows (ALT_SEPARATOR)
		# otherwise - system separator
		return @@separator = cygwin? ? '\\' : (ALT_SEPARATOR || SEPARATOR)
	end

	def self.cygpath(path, flag = nil)
		flag ||= '-w'
		# convert to Windows path
		path = `cygpath #{flag} "#{path}"`.chomp
	end

	def self.expand_path2(path, flag = nil)
		path = expand_path(path)
		return path unless cygwin?
		return cygpath(path, flag)
	end

	def self.dirname2(path, flag = nil)
		path = dirname(path)
		return path unless cygwin?
		path = cygpath(path, flag)
		path.gsub!('\\', '\\\\') unless flag
		path
	end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
rake-delphi-0.0.34 lib/rake/helpers/file.rb
rake-delphi-0.0.33 lib/rake/helpers/file.rb
rake-delphi-0.0.32 lib/rake/helpers/file.rb
rake-delphi-0.0.31 lib/rake/helpers/file.rb
rake-delphi-0.0.29 lib/rake/helpers/file.rb
rake-delphi-0.0.30 lib/rake/helpers/file.rb
rake-delphi-0.0.28 lib/rake/helpers/file.rb
rake-delphi-0.0.27 lib/rake/helpers/file.rb