Sha256: 0bdc9cf8f696a497f32b7bf591ac4282978cc5b6a746a65d04453af0e0c8fde8

Contents?: true

Size: 808 Bytes

Versions: 3

Compression:

Stored size: 808 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 ? 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)
		path = expand_path(path)
		return path unless cygwin?
		return cygpath(path)
	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

3 entries across 3 versions & 1 rubygems

Version Path
rake-delphi-0.0.6 lib/rake/helpers/file.rb
rake-delphi-0.0.5 lib/rake/helpers/file.rb
rake-delphi-0.0.4 lib/rake/helpers/file.rb