It returns the following three values:
...\FH Projects\xyz\
xyz.fh_data
fh_data
which is somewhat misleading as xyz.fh_data is a folder and NOT a file, and fh_data is NOT a file type.
If a folder such as ...\FH Projects\xyz is used it returns three nil values.
The following alternative function works rather better:
Code: Select all
-- Return the Path, Filename, and extension as 3 values
function SplitFilename(strFilename)
if lfs.attributes(strFilename,"mode") == "file" then
return strFilename:match("(.-)([^\\]-([^\\%.]+))$")
end
local strPath = strFilename:gsub("[\\/]$","")
return strPath.."\\","",""
end -- function SplitFilename
...\FH Projects\xyz\xyz.fh_data\ or ...\FH Projects\xyz\
plus two empty strings.