fileio/
mg_check_path.pro
includes main-level programRoutines
top mg_check_path
result = mg_check_path(path [, error_path=string])
Check a file path to see if it exists. If not, then can determine which portion of the path is incorrect.
Return value
1 if filepath exists, 0 if not
Parameters
- path in required type=string
filepath to check
Keywords
- error_path out optional type=string
set to a named variable to return the portion of the path which first is is incorrect
Examples
Try the main-level example program at the end of this file with:
IDL> .run mg_check_path
Path: /Applications/exelis/idl82/lib/unknown_dir/unknown_file.dat
Problem: /Applications/exelis/idl82/lib/unknown_dir
IDL> path = filepath('unknown_file.dat', subdir=['lib', 'unknown_dir'])
IDL> print, path, format='(%"Path: %s")'
Path: /Applications/exelis/idl82/lib/unknown_dir/unknown_file.dat
IDL> found = mg_check_path(path, error_path=ppath)
IDL> if (~found) then print, ppath, format='(%"Problem: %s")'
Problem: /Applications/exelis/idl82/lib/unknown_dir
File attributes
Modification date: | Wed May 14 15:07:14 2014 |
Lines: | 17 |
Docformat: | rst rst |
Contact me if you have enhancement requests or bug fixes.