Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(858)

Side by Side Diff: base/path.h

Issue 624713003: Keep only base/extractor.[cc|h]. (Closed) Base URL: https://chromium.googlesource.com/external/omaha.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/omaha_version_unittest.cc ('k') | base/path.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2007-2009 Google Inc.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 // ========================================================================
15 //
16 // Path utility functions.
17
18 #ifndef OMAHA_BASE_PATH_H_
19 #define OMAHA_BASE_PATH_H_
20
21 #include <atlstr.h>
22 #include <vector>
23
24 namespace omaha {
25
26 // Get the starting path from the command string
27 CString GetStartingPathFromString(const CString& s);
28
29 // Get the trailing path from the command string
30 CString GetTrailingPathFromString(const CString& s);
31
32 // Get the file from the command string
33 HRESULT GetFileFromCommandString(const TCHAR* s, CString* file);
34
35 // Expands the string with embedded special folder variables
36 HRESULT ExpandStringWithSpecialFolders(CString* str);
37
38 // Normalize a path
39 HRESULT NormalizePath(const TCHAR* path, CString* normalized_path);
40
41 // Concatenate two paths together
42 CString ConcatenatePath(const CString& path1, const CString& path2);
43
44 // Get the file out of the file path
45 CString GetFileFromPath(const CString& path);
46
47 // Get the directory from the path
48 CString GetDirectoryFromPath(const CString& path);
49
50 // Remove the extension from the path.
51 CString GetPathRemoveExtension(const CString& path);
52
53 // Returns true iff path is an absolute path (starts with a drive name)
54 bool IsAbsolutePath(const TCHAR* path);
55
56 // Makes sure the path is enclosed with double quotation marks.
57 void EnclosePath(CString* path);
58
59 // Used to enclose paths that are typically used with LocalServer32 entries.
60 // Unenclosed LocalServer32 entries with spaces are not recommended because
61 // the LocalServer32 entry is a command line, not just an EXE path.
62 // DLL paths should not be enclosed, because InProcServer32 entries are just
63 // a DLL path and not a command line.
64 CString EnclosePathIfExe(const CString& module_path);
65
66 // remove any double quotation masks from an enclosed path
67 void UnenclosePath(CString* path);
68
69 // Removes a trailing double quote from a path. ::CommandLineToArgvW() has some
70 // strange treatment for quotation marks and backslashes, as detailed here:
71 // http://blogs.msdn.com/b/oldnewthing/archive/2010/09/17/10063629.aspx
72 //
73 // So an argument containing a directory path with a trailing backslash:
74 // <<prog.exe /dir "c:\a dir\">>
75 // is incorrectly parsed with a double-quote at the end:
76 // <<c:\a dir">>.
77 void RemoveMismatchedEndQuoteInDirectoryPath(CString* directory_path);
78
79 // Converts the short path name to long name.
80 HRESULT ShortPathToLongPath(const CString& short_path, CString* long_path);
81
82 // Returns a list of files that match the criteria.
83 HRESULT FindFiles(const CString& dir,
84 const CString& pattern,
85 std::vector<CString>* files);
86
87 HRESULT FindFilesEx(const CString& dir,
88 const CString& pattern,
89 std::vector<CString>* files);
90
91 HRESULT FindFileRecursive(const CString& dir,
92 const CString& pattern,
93 std::vector<CString>* files);
94
95 } // namespace omaha
96
97 #endif // OMAHA_BASE_PATH_H_
OLDNEW
« no previous file with comments | « base/omaha_version_unittest.cc ('k') | base/path.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698