jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
Signup
DamageControl
  • DamageControl
  • DC-439

RSCM bug on windows

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Blocker Blocker
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: 0.6.0
  • Component/s: CVS, Subversion
  • Labels:
    None
  • Number of attachments :
    0

Description

From Xavier Priour:

Hi,
RSCM gem crashes on windows. The problem is the 5th line that calls RSCM::PathConverter before it is declared.

A quick working solution is to put AFTER the class declaration the lines assigning HOMEDIR, and the line requiring rscm\logging (as it uses HOMEDIR).

Regards,

Here is the new code:
------------------------

WIN32 = RUBY_PLATFORM == "i386-mswin32"
CYGWIN = RUBY_PLATFORM == "i386-cygwin"
WINDOWS = WIN32 || CYGWIN

require 'fileutils'

def with_working_dir(dir)

  1. Can't use Dir.chdir { block }

    - will fail with multithreaded code.

  2. http://www.ruby-doc.org/core/classes/Dir.html#M000790
    #
    prev = Dir.pwd
    begin
    dir = File.expand_path(dir)
    FileUtils.mkdir_p(dir)
    Dir.chdir(dir)
    yield
    ensure
    Dir.chdir(prev)
    end
    end
  1. Utility for converting between win32 and cygwin paths. Does nothing on *nix.
    module RSCM
    module PathConverter
    def filepath_to_nativepath(path, escaped)
    return nil if path.nil?
    path = File.expand_path(path)
    if(WIN32)
    path.gsub(/\//, "\")
    elsif(CYGWIN)
    cmd = "cygpath --windows # {path}"
    Better.popen(cmd) do |io|
    cygpath = io.read.chomp
    escaped ? cygpath.gsub(/\/, "\\\\") : cygpath
    end
    else
    path
    end
    end

    def filepath_to_nativeurl(path)
    return nil if path.nil?
    if(WINDOWS)
    urlpath = filepath_to_nativepath(path, false).gsub(/\/, "/")
    "file:///#{urlpath}"
    else
    "file://#{File.expand_path(path)}"
    end
    end

    def nativepath_to_filepath(path)
    return nil if path.nil?
    if(WIN32)
    path.gsub(/\//, "\")
    elsif(CYGWIN)
    path = path.gsub(/\/, "/")
    cmd = "cygpath --unix #{path}

    "
    Better.popen(cmd) do |io|
    io.read.chomp
    end
    else
    path
    end
    end

def ensure_trailing_slash(url)
return nil if url.nil?
if(url && url[-1..-1] != "/")
"#

{url}

/"
else
url
end
end

module_function :filepath_to_nativepath
module_function :filepath_to_nativeurl
module_function :nativepath_to_filepath
module_function :ensure_trailing_slash
end
end

if(WINDOWS)
HOMEDIR = RSCM::PathConverter.nativepath_to_filepath("#

{ENV['HOMEDRIVE']}

#

{ENV['HOMEPATH']}

").gsub(/\/, "/")
else
HOMEDIR = ENV['HOME']
end

require 'rscm/logging'

Activity

  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
Aslak Hellesøy added a comment - 01/Sep/05 7:13 PM

Fixed

Show
Aslak Hellesøy added a comment - 01/Sep/05 7:13 PM Fixed

People

  • Assignee:
    Aslak Hellesøy
    Reporter:
    Aslak Hellesøy
Vote (0)
Watch (0)

Dates

  • Created:
    05/Aug/05 5:23 AM
    Updated:
    01/Sep/05 7:13 PM
    Resolved:
    01/Sep/05 7:13 PM
  • Atlassian JIRA (v5.2.7#850-sha1:b2af0c8)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.