{{newin|[[0.9.2]]|092|type=function}}
Gets the platform-specific absolute path of the directory containing a filepath.

This can be used to determine whether a file is inside the save directory or the game's source .love.
== Function ==
=== Synopsis ===
<source lang="lua">
realdir = love.filesystem.getRealDirectory( filepath )
</source>
=== Arguments ===
{{param|string|filepath|The filepath to get the directory of.}}
=== Returns ===
{{param|string|realdir|The platform-specific full path of the directory containing the filepath.}}
== Notes ==
This function returns the directory containing the given ''file path'', rather than file. For example, if the file <code>screenshot1.png</code> exists in a directory called <code>screenshots</code> in the game's save directory, <code>love.filesystem.getRealDirectory("screenshots/screenshot1.png")</code> will return the same value as [[love.filesystem.getSaveDirectory]].
== Examples ==
<source lang="lua">
-- Get all files in the "levels" folder.
-- There might be a "levels" folder in both the save directory and the game's source,
-- in which case this will get all files in both.
local filepaths = love.filesystem.getDirectoryItems("levels")

for i, filename in ipairs(filepaths) do
    -- For each filename, check whether it's in the save directory or not.
    local path = "levels/"..filename
    if love.filesystem.getRealDirectory(path) == love.filesystem.getSaveDirectory() then
        -- This file is in the save directory.
    end
end
</source>
== See Also ==
* [[parent::love.filesystem]]
[[Category:Functions]]
{{#set:Description=Gets the absolute path of the directory containing a filepath.}}
== Other Languages ==
{{i18n|love.filesystem.getRealDirectory}}