find_data_file Function

public function find_data_file(name) result(path)

The path of data file name: name itself if it exists (a path, or a file in the current directory), else the first match in the directories of the VKFRAMES_DATA_PATH environment variable; '' if not found.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: name

a path, or a file name

Return Value character(len=:), allocatable


Calls

proc~~find_data_file~~CallsGraph proc~find_data_file find_data_file proc~find_in_dirs find_in_dirs proc~find_data_file->proc~find_in_dirs

Called by

proc~~find_data_file~~CalledByGraph proc~find_data_file find_data_file proc~apply_layer apply_layer proc~apply_layer->proc~find_data_file proc~elevation TerrainBody%elevation proc~elevation->proc~find_data_file proc~read_constellations read_constellations proc~read_constellations->proc~find_data_file proc~read_stars read_stars proc~read_stars->proc~find_data_file proc~read_texture read_texture proc~read_texture->proc~find_data_file proc~set_texture_map~2 SkySphere%set_texture_map proc~set_texture_map~2->proc~find_data_file proc~set_tick_image CoordinateAxes%set_tick_image proc~set_tick_image->proc~find_data_file proc~add_layer add_layer proc~add_layer->proc~apply_layer proc~make_map make_map proc~make_map->proc~apply_layer proc~set_constellations SkySphere%set_constellations proc~set_constellations->proc~read_constellations proc~set_star_data SkySphere%set_star_data proc~set_star_data->proc~read_stars proc~sphere_build_contents Sphere%sphere_build_contents proc~sphere_build_contents->proc~read_texture proc~add_elevation_layer TerrainBody%add_elevation_layer proc~add_elevation_layer->proc~add_layer proc~add_image_layer TerrainBody%add_image_layer proc~add_image_layer->proc~add_layer proc~terrain_build_contents TerrainBody%terrain_build_contents proc~terrain_build_contents->proc~make_map proc~terrain_update TerrainBody%terrain_update proc~terrain_update->proc~make_map

Source Code

    function find_data_file(name) result(path)
        character(len=*), intent(in) :: name        !! a path, or a file name
        character(len=:), allocatable :: path
        character(len=4096) :: env
        integer :: status
        logical :: exists
        path = ''
        if (len_trim(name) == 0) return
        inquire(file=trim(name), exist=exists)
        if (exists) then
            path = trim(name)
            return
        end if
        call get_environment_variable('VKFRAMES_DATA_PATH', env, status=status)
        if (status == 0) path = find_in_dirs(trim(name), trim(env))
    end function find_data_file