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

Require absolute filenames #622

Merged
merged 1 commit into from Jun 7, 2015

Conversation

Projects
None yet
4 participants
@ddfreyne
Copy link
Member

ddfreyne commented Jun 7, 2015

This removes a dependency on the current working directory.

Documentation changes:

  • Filenames used when generating items or layouts need to be absolute.

ddfreyne added a commit that referenced this pull request Jun 7, 2015

Merge pull request #622 from nanoc/absolute-paths
Require absolute filenames

@ddfreyne ddfreyne merged commit 0f740fe into master Jun 7, 2015

1 check was pending

continuous-integration/travis-ci/pr The Travis CI build is in progress
Details

@ddfreyne ddfreyne deleted the absolute-paths branch Jun 7, 2015

@@ -15,6 +15,10 @@ class Content

# @param [String, nil] filename
def initialize(filename)
if filename && !filename.start_with?('/')
raise ArgumentError, 'Content filename is not absolute'
end

This comment has been minimized.

Copy link
@bobthecow

bobthecow Jun 7, 2015

Member

does this work on the windoze?

This comment has been minimized.

Copy link
@ddfreyne

ddfreyne Jun 7, 2015

Author Member

Probably not. :(

This comment has been minimized.

Copy link
@ddfreyne

ddfreyne Jun 21, 2015

Author Member

And I can’t verify/test, because I don’t have access to a Windows machine.

This comment has been minimized.

Copy link
@Crazycatz00

Crazycatz00 Jun 22, 2015

I can verify this does not work on windows; it throws for the filename "D:/site/content/htaccess.noext".
I was however able to get this to work using !Pathname.new(filename).absolute? instead of !filename.start_with?('/'). (I'm using a 64-bit build from http://rubyinstaller.org/, not sure if this works for all ruby types though.)

This comment has been minimized.

Copy link
@ddfreyne

ddfreyne Jun 22, 2015

Author Member

Fix in #656.

@ddfreyne ddfreyne modified the milestone: 4.0.0 Jun 20, 2015

@gpakosz

This comment has been minimized.

Copy link
Member

gpakosz commented Jun 22, 2015

I find it indeed better to use Pathname

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.