# Searching for files

A file name may or may not contain a device specifier (such as D: or cdrom0:). If it does, the device on which the file is being opened must be registered with RealFile::AddDevice. If it does not contain a device specifier, the library will perform a search to try to find it. Each location in the search path is checked and the file is opened in the first location that it is found.

After the `rw::core::filesys::Manager` object has been created, this path is set to the current working directory or device. Any other locations to search must be added to the search path with `rw::core::filesys::Manager::AddSearchLocation`.

For example, you might set a search path like this:

    rw::core::filesys::Manager::SetSearchPath("d:\\;c:\\");

Then open a file named like this:

    rw::core::filesys::AsyncOp::Open("hello.txt", rw::core::filesys::AsyncOp::FOPEN_READONLY);

The library will first search for "d:\\hello.txt" and if it is not found, will try "c:\\hello.txt". If "c:\\hello.txt" is not found either, the open operation will fail.