1 /*
2  * Copyright 2009-2017 Alibaba Cloud All rights reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #include <string>
18 #include <fstream>
19 #include <memory>
20 #include <alibabacloud/oss/Types.h>
21 
22 namespace AlibabaCloud
23 {
24 namespace OSS
25 {
26     bool CreateDirectory(const std::string &folder);
27     bool RemoveDirectory(const std::string &folder);
28     bool RemoveFile(const std::string &filepath);
29     bool RenameFile(const std::string &from, const std::string &to);
30     bool GetPathLastModifyTime(const std::string &path, time_t &t);
31     bool IsDirectoryExist(std::string folder);
32     bool GetPathInfo(const std::string &path, time_t &t, std::streamsize& size);
33     bool IsFileExist(const std::string& file);
34 
35     //wchar path
36 #ifdef _WIN32
37     bool CreateDirectory(const std::wstring& folder);
38     bool RemoveDirectory(const std::wstring& folder);
39     bool RemoveFile(const std::wstring& filepath);
40     bool RenameFile(const std::wstring& from, const std::wstring& to);
41     bool GetPathLastModifyTime(const std::wstring& path, time_t& t);
42     bool IsDirectoryExist(std::wstring folder);
43     bool GetPathInfo(const std::wstring &path, time_t &t, std::streamsize& size);
44     bool IsFileExist(const std::wstring& file);
45 #endif
46 
47     std::shared_ptr<std::fstream> GetFstreamByPath(
48         const std::string& path,
49         const std::wstring& pathw,
50         std::ios_base::openmode mode);
51 }
52 }
53