2 * Copyright 2016 Google Inc.
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
8 #ifndef SkOSPath_DEFINED
9 #define SkOSPath_DEFINED
11 #include "include/core/SkString.h"
14 * Functions for modifying SkStrings which represent paths on the filesystem.
19 const static char SEPARATOR = '\\';
21 const static char SEPARATOR = '/';
25 * Assembles rootPath and relativePath into a single path, like this:
26 * rootPath/relativePath.
27 * It is okay to call with a NULL rootPath and/or relativePath. A path
28 * separator will still be inserted.
30 * Uses SkPATH_SEPARATOR, to work on all platforms.
32 static SkString Join(const char* rootPath, const char* relativePath);
35 * Return the name of the file, ignoring the directory structure.
36 * Behaves like python's os.path.basename. If the fullPath is
37 * /dir/subdir/, an empty string is returned.
38 * @param fullPath Full path to the file.
39 * @return SkString The basename of the file - anything beyond the
40 * final slash, or the full name if there is no slash.
42 static SkString Basename(const char* fullPath);
45 * Given a qualified file name returns the directory.
46 * Behaves like python's os.path.dirname. If the fullPath is
47 * /dir/subdir/ the return will be /dir/subdir/
48 * @param fullPath Full path to the file.
49 * @return SkString The dir containing the file - anything preceding the
50 * final slash, or the full name if ending in a slash.
52 static SkString Dirname(const char* fullPath);