Merge pull request #289 from Blizzard/add-wks-getrelative
add workspace.getrelative(sln, filename)
This commit is contained in:
commit
6e6e30b413
@ -163,3 +163,31 @@
|
|||||||
function workspace.hasProject(self, func)
|
function workspace.hasProject(self, func)
|
||||||
return p.container.hasChild(self, p.project, func)
|
return p.container.hasChild(self, p.project, func)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Return the relative path from the solution to the specified file.
|
||||||
|
--
|
||||||
|
-- @param self
|
||||||
|
-- The workspace object to query.
|
||||||
|
-- @param filename
|
||||||
|
-- The file path, or an array of file paths, to convert.
|
||||||
|
-- @return
|
||||||
|
-- The relative path, or array of paths, from the workspace to the file.
|
||||||
|
--
|
||||||
|
|
||||||
|
function workspace.getrelative(self, filename)
|
||||||
|
if type(filename) == "table" then
|
||||||
|
local result = {}
|
||||||
|
for i, name in ipairs(filename) do
|
||||||
|
if name and #name > 0 then
|
||||||
|
table.insert(result, workspace.getrelative(self, name))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return result
|
||||||
|
else
|
||||||
|
if filename then
|
||||||
|
return path.getrelative(self.location, filename)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
Reference in New Issue
Block a user