Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix windows compatibility #114

Merged
merged 1 commit into from
Nov 12, 2021
Merged

Fix windows compatibility #114

merged 1 commit into from
Nov 12, 2021

Commits on Nov 12, 2021

  1. Fix windows compatibility

    Previously I made the assumption that the filename would be the first part of the error message for a syntax error before the colon `:` while this is false, it is especially false on windows where every path starts with a drive letter and a colon such as `c://hello/world.rb`.
    
    This commit fixes that problem by checking for the file on disk and appending more parts to the string.
    
    This is not foolproof because an error message might be possible that someone is using a colon with a file that actually exists in front of it like:
    
    ```
    /lol/foo.rb:imactuallyadirectory/realfile.rb
    ```
    
    In this case if `/lol/foo.rb` existed then it would quit looking.
    
    While I'm noting this edge case for completeness, I am not currently handling it. I think case that would be rare. 
    
    When SyntaxError is refactored in Ruby 3.2 then we don't have to rely on parsing out filenames anymore. 
    
    
    Close #111
    schneems committed Nov 12, 2021
    Configuration menu
    Copy the full SHA
    9ae13c8 View commit details
    Browse the repository at this point in the history