File: path_service.h

package info (click to toggle)
texmaker 5.1.3%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 80,256 kB
  • sloc: cpp: 429,691; ansic: 192,386; python: 1,935; xml: 1,724; asm: 205; sh: 176; makefile: 46
file content (37 lines) | stat: -rw-r--r-- 1,267 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Copyright 2015 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef TESTING_UTILS_PATH_SERVICE_H_
#define TESTING_UTILS_PATH_SERVICE_H_

#include <string>

#ifdef _WIN32
#define PATH_SEPARATOR '\\'
#else
#define PATH_SEPARATOR '/'
#endif

// Get the various file directory and path information.
class PathService {
 public:
  // Return true when the path ends with a path separator.
  static bool EndsWithSeparator(const std::string& path);

  // Retrieve the directory where executables run from.
  static bool GetExecutableDir(std::string* path);

  // Retrieve the root directory of the source tree.
  // Assume executables always run from out/<Debug|Release>/, the source
  // directory is two levels above the executable directory.
  static bool GetSourceDir(std::string* path);

  // Retrieve the test data directory where test files are stored.
  // Currently, the test dir is under <source_dir>/testing/resources/.
  static bool GetTestDataDir(std::string* path);

  // Get the full path for a test file under the test data directory.
  static bool GetTestFilePath(const std::string& file_name, std::string* path);
};
#endif  // TESTING_UTILS_PATH_SERVICE_H_