Files
android/libwvdrmengine/cdm/util/include/file_utils.h
Rahul Frias 9d1c9ca76a Add error details when offline license is not found
[ Merge of http://go/wvgerrit/171310 ]

Offline license not found errors are identified by CdmResponseEnum
347 (KEYSET_ID_NOT_FOUND_4). No addition file system information
is shared.

Checks for file existance use the stat command. The stat call can
return error codes from errno.h when the command fails.
These are now converted into sub error codes and returned along with
the offline license file not found error.

This also includes a change to log stat errors other than
ENOENT (no such file or directory) as a warning rather than verbose.

Bug: 276225520
Test: file_store_unittest, file_utils_unittest, GtsMediaTestCases
Change-Id: Ic09d036549582cd65783b49fa96ffefc4bf562c7
2023-04-28 02:38:35 -07:00

30 lines
992 B
C++

// Copyright 2018 Google LLC. All Rights Reserved. This file and proprietary
// source code may only be used and distributed under the Widevine License
// Agreement.
#include <string>
#include <vector>
namespace wvutil {
const char kCurrentDirectory[] = ".";
const char kParentDirectory[] = "..";
const char kDirectoryDelimiter = '/';
const char kWildcard[] = "*";
bool IsCurrentOrParentDirectory(const char* dir);
class FileUtils {
public:
static bool Exists(const std::string& src);
static bool Exists(const std::string& src, int* errno_value);
// 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 wvutil