find_in_dirs Function

public function find_in_dirs(name, dirs) result(path)

The path dir/name of the first directory in dirs (separated by ';' or ':', except a ':' after a drive letter) that has name, or ''.

Arguments

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

file name

character(len=*), intent(in) :: dirs

directories, separated by ';' or ':'

Return Value character(len=:), allocatable


Called by

proc~~find_in_dirs~~CalledByGraph proc~find_in_dirs find_in_dirs proc~find_data_file find_data_file proc~find_data_file->proc~find_in_dirs proc~find_font find_font proc~find_font->proc~find_in_dirs proc~apply_layer apply_layer proc~apply_layer->proc~find_data_file proc~elevation TerrainBody%elevation proc~elevation->proc~find_data_file proc~get_font get_font proc~get_font->proc~find_font 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~window_gui WindowProxy%window_gui proc~window_gui->proc~find_font proc~add_layer add_layer proc~add_layer->proc~apply_layer proc~label_create label_create proc~label_create->proc~get_font 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~make_star_node make_star_node proc~set_star_data->proc~make_star_node 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~create_hud create_hud proc~create_hud->proc~label_create proc~make_axis make_axis proc~make_axis->proc~label_create proc~make_name_label make_name_label proc~make_name_label->proc~label_create proc~make_name_node make_name_node proc~make_name_node->proc~label_create 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 proc~add_hud_text WindowProxy%add_hud_text proc~add_hud_text->proc~create_hud proc~build_decorations build_decorations proc~build_decorations->proc~make_axis proc~build_decorations->proc~make_name_label proc~create_huds create_huds proc~create_huds->proc~create_hud proc~make_star_node->proc~make_name_node proc~move_axis move_axis proc~move_axis->proc~make_axis proc~remake_axes remake_axes proc~remake_axes->proc~make_axis proc~set_label_font ReferenceFrame%set_label_font proc~set_label_font->proc~make_name_label proc~set_label_font->proc~remake_axes proc~set_star_names SkySphere%set_star_names proc~set_star_names->proc~make_name_node proc~set_x_label ReferenceFrame%set_x_label proc~set_x_label->proc~make_axis proc~set_y_label ReferenceFrame%set_y_label proc~set_y_label->proc~make_axis proc~set_z_label ReferenceFrame%set_z_label proc~set_z_label->proc~make_axis proc~update_huds update_huds proc~update_huds->proc~create_hud proc~frame WindowProxy%frame proc~frame->proc~create_huds proc~frame->proc~update_huds proc~realize ReferenceFrame%realize proc~frame->proc~realize proc~move_x_axis ReferenceFrame%move_x_axis proc~move_x_axis->proc~move_axis proc~move_y_axis ReferenceFrame%move_y_axis proc~move_y_axis->proc~move_axis proc~move_z_axis ReferenceFrame%move_z_axis proc~move_z_axis->proc~move_axis proc~node~2 SkySphere%node proc~node~2->proc~make_star_node proc~realize->proc~build_decorations proc~realize->proc~realize proc~relayout_labels relayout_labels proc~relayout_labels->proc~remake_axes proc~set_color~2 ReferenceFrame%set_color proc~set_color~2->proc~remake_axes proc~add_child ReferenceFrame%add_child proc~add_child->proc~realize proc~axes_set_color CoordinateAxes%axes_set_color proc~axes_set_color->proc~set_color~2 proc~grid_set_color LatLonGrid%grid_set_color proc~grid_set_color->proc~set_color~2 proc~new_reference_frame new_reference_frame proc~new_reference_frame->proc~set_color~2 proc~place_axes place_axes proc~place_axes->proc~move_x_axis proc~place_axes->proc~move_y_axis proc~place_axes->proc~move_z_axis proc~place_grid_axes place_grid_axes proc~place_grid_axes->proc~move_x_axis proc~place_grid_axes->proc~move_y_axis proc~place_grid_axes->proc~move_z_axis proc~resize WindowProxy%resize proc~resize->proc~frame proc~run WindowProxy%run proc~run->proc~frame proc~segments_set_color CustomLineSegments%segments_set_color proc~segments_set_color->proc~set_color~2 proc~set_label_alignment ReferenceFrame%set_label_alignment proc~set_label_alignment->proc~relayout_labels proc~set_label_size ReferenceFrame%set_label_size proc~set_label_size->proc~relayout_labels proc~set_sky WindowProxy%set_sky proc~set_sky->proc~node~2 proc~sphere_set_color Sphere%sphere_set_color proc~sphere_set_color->proc~set_color~2 proc~time_set_color TimeHandle%time_set_color proc~time_set_color->proc~set_color~2 proc~vector_set_color VectorHandle%vector_set_color proc~vector_set_color->proc~set_color~2 interface~referenceframe ReferenceFrame interface~referenceframe->proc~new_reference_frame proc~grid_set_parameters LatLonGrid%grid_set_parameters proc~grid_set_parameters->proc~place_grid_axes proc~new_coordinate_axes new_coordinate_axes proc~new_coordinate_axes->proc~place_axes proc~new_lat_lon_grid new_lat_lon_grid proc~new_lat_lon_grid->proc~place_grid_axes proc~new_radial_plane new_radial_plane proc~new_radial_plane->proc~place_axes proc~plane_set_parameters RadialPlane%plane_set_parameters proc~plane_set_parameters->proc~place_axes proc~set_axis_length CoordinateAxes%set_axis_length proc~set_axis_length->proc~place_axes interface~coordinateaxes CoordinateAxes interface~coordinateaxes->proc~new_coordinate_axes interface~latlongrid LatLonGrid interface~latlongrid->proc~new_lat_lon_grid interface~radialplane RadialPlane interface~radialplane->proc~new_radial_plane

Source Code

    function find_in_dirs(name, dirs) result(path)
        character(len=*), intent(in) :: name        !! file name
        character(len=*), intent(in) :: dirs        !! directories, separated by ';' or ':'
        character(len=:), allocatable :: path
        integer :: i, j
        logical :: exists
        path = ''
        i = 1
        do while (i <= len(dirs))
            j = i
            do while (j <= len(dirs))
                if (dirs(j:j) == ';' .or. (dirs(j:j) == ':' .and. j > i + 1)) exit   ! ':' not after a drive letter
                j = j + 1
            end do
            if (j > i) then
                inquire(file=dirs(i:j-1)//'/'//name, exist=exists)
                if (exists) then
                    path = dirs(i:j-1)//'/'//name
                    return
                end if
            end if
            i = j + 1
        end do
    end function find_in_dirs