Class: AssLauncher::Support::Platforms::PathnameExt::CygPath

Inherits:
AssLauncher::Support::Platforms::PathnameExt show all
Defined in:
lib/ass_launcher/support/platforms.rb

Overview

Class for Cygwin Ruby

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from AssLauncher::Support::Platforms::PathnameExt

#+, #initialize, #win_string

Constructor Details

This class inherits a constructor from AssLauncher::Support::Platforms::PathnameExt

Class Method Details

.cygpath(p1, flag) ⇒ Object



215
216
217
218
219
220
221
222
# File 'lib/ass_launcher/support/platforms.rb', line 215

def self.cygpath(p1, flag)
  fail ArgumentError, 'Only accepts :w | :m | :u flags'\
    unless %w(w m u).include? flag.to_s
  # TODO, extract shell call into Shell module
  out = `cygpath -#{flag} #{p1.escape} 2>&1`.chomp
  fail Shell::RunError, out unless exitstatus == 0
  out
end

.glob(p1, *args) ⇒ Array<PathnameExt>

Override (Pathname.glob) method for correct work with windows paths like a ‘\\host\share’, ‘C:\’ and Cygwin paths like a ‘/cygdrive/c’

Returns:



211
212
213
# File 'lib/ass_launcher/support/platforms.rb', line 211

def self.glob(p1, *args)
  super cygpath(p1, :u), *args
end

Instance Method Details

#cygpath(p1, flag) ⇒ Object



233
234
235
# File 'lib/ass_launcher/support/platforms.rb', line 233

def cygpath(p1, flag)
  self.class.cygpath(p1, flag)
end

#mixed_path(string) ⇒ Object

(cee PathnameExt#mixed_path)



206
207
208
# File 'lib/ass_launcher/support/platforms.rb', line 206

def mixed_path(string)
  cygpath(string, :m)
end