1// Aseprite
2// Copyright (C) 2017-2018 David Capello
3//
4// This program is distributed under the terms of
5// the End-User License Agreement for Aseprite.
6
7#ifdef HAVE_CONFIG_H
8#include "config.h"
9#endif
10
11#include "app/font_path.h"
12
13#include "base/fs.h"
14
15namespace app {
16
17std::string find_font(const std::string& firstDir,
18 const std::string& filename)
19{
20 std::string fn = base::join_path(firstDir, filename);
21 if (base::is_file(fn))
22 return fn;
23
24 base::paths fontDirs;
25 get_font_dirs(fontDirs);
26
27 for (const std::string& dir : fontDirs) {
28 fn = base::join_path(dir, filename);
29 if (base::is_file(fn))
30 return fn;
31 }
32
33 return std::string();
34}
35
36} // namespace app
37