[ Merge of http://go/wvgerrit/84989 ] FileUtils::Remove() when used with wildcards would ignore a prefix specified before the asterisk and delete all files with the same extension. Fix proposed by broadcom. Bug: 120039689 Test: WV unit/integration tests Change-Id: Iddc6c6b1983c41b501b21f34626f56c0b74af6c8
31 lines
954 B
C++
31 lines
954 B
C++
// Copyright 2018 Google LLC. All Rights Reserved. This file and proprietary
|
|
// source code may only be used and distributed under the Widevine Master
|
|
// License Agreement.
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "wv_cdm_types.h"
|
|
|
|
namespace wvcdm {
|
|
|
|
const char kCurrentDirectory[] = ".";
|
|
const char kParentDirectory[] = "..";
|
|
const char kDirectoryDelimiter = '/';
|
|
const char kWildcard[] = "*";
|
|
bool IsCurrentOrParentDirectory(char* dir);
|
|
|
|
class FileUtils {
|
|
public:
|
|
static bool Exists(const std::string& src);
|
|
// The caller may only specifying a single wildcard
|
|
static bool Remove(const std::string& src);
|
|
static bool Copy(const std::string& src, const std::string& dest);
|
|
static bool List(const std::string& path, std::vector<std::string>* files);
|
|
static bool IsRegularFile(const std::string& path);
|
|
static bool IsDirectory(const std::string& path);
|
|
static bool CreateDirectory(const std::string& path);
|
|
};
|
|
|
|
} // namespace wvcdm
|