This message was deleted.
# community-support
s
This message was deleted.
j
project.layout.dir(...)
doesn't use the project dir as starting point for the file, right?
Not very elegant that I have to wrap it with a
provider
Copy code
project.layout.dir(project.provider { project.file("${project.gitDir}/refs/heads") })
v
project.layout.projectDirectory.dir(...)
results in a directory relative to the project directory
j
then that is not valid for me, is there another way to build a
Directory
?
v
I don't understand, you asked for it and now it is not valid?
j
Looks like it is picking the right directories:
Copy code
> Configure project :
D:\Repos\gradle\semver-plugin-playground\.git\index
D:\Repos\gradle\semver-plugin-playground\.git\refs\heads
Copy code
> Configure project :library-one-a
D:\Repos\gradle\semver-plugin-playground\.git\index
D:\Repos\gradle\semver-plugin-playground\.git\refs\heads
I am accessing to
.git
, so I can't use the subproject directory as relative directory
but looks like
project.layout.dir(...)
picks whatever you pass
My implementation is not very intuitive as
project.gitDir
is doing under the hood
project.rootDir
to fetch the
.git
directory
v
Yes,
project.layout.dir(...)
picks whatever you pass. I'm not sure how it handles relative paths though.
👍 1
But as you are suppliying an absolute path, it should work and even
project.layout.projectDirectory.dir
would work as it does not change absolute paths.
Just unnecessary if you know that the path is absolute anyway.
j
it is good to know that tho, thank you!
v
Well, it's just logical, what should it do with an absolute path? 😄
Well,
layout.projectDirectory.dir(...)
with a known absolute path would have the potential pro that it gives back a
Directory
not
Provider<Directory>
, but you can of course as well simply call
get()
on that.
👍 1
thank you 1