Content-Length: 946228 | pFad | http://github.com/gusenov/examples-cpp/commit/2cd0abe15bf534c917bcfbca70694daaa19c4612

67 Копирование папки. · gusenov/examples-cpp@2cd0abe · GitHub
Skip to content

Commit 2cd0abe

Browse files
committed
Копирование папки.
1 parent 69e0dfd commit 2cd0abe

27 files changed

+695
-0
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
- [std::wcout, std::wcerr, std::wcin](syncfusion/cpp_succinctly/ConsoleSample)
2222
- [std::ofstream никогда не создает папки](fs/out-to-file)
2323
- [Создание каталога с помощью функции mkdir() из библиотеки C POSIX](fs/posix-create-dir-if-not-exists)
24+
- [Копирование папки](fs/copy-dir)
2425

2526
# Типы данных
2627

fs/copy-dir/.gitignore

+160
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
# ---------------------------------------------------------------------------
2+
# https://github.com/github/gitignore/blob/master/Global/macOS.gitignore
3+
4+
# General
5+
.DS_Store
6+
.AppleDouble
7+
.LSOverride
8+
9+
# Icon must end with two \r
10+
Icon
11+
12+
# Thumbnails
13+
._*
14+
15+
# Files that might appear in the root of a volume
16+
.DocumentRevisions-V100
17+
.fseventsd
18+
.Spotlight-V100
19+
.TemporaryItems
20+
.Trashes
21+
.VolumeIcon.icns
22+
.com.apple.timemachine.donotpresent
23+
24+
# Directories potentially created on remote AFP share
25+
.AppleDB
26+
.AppleDesktop
27+
Network Trash Folder
28+
Temporary Items
29+
.apdisk
30+
31+
# ---------------------------------------------------------------------------
32+
# https://github.com/github/gitignore/blob/master/C++.gitignore
33+
34+
# Prerequisites
35+
*.d
36+
37+
# Compiled Object files
38+
*.slo
39+
*.lo
40+
*.o
41+
*.obj
42+
43+
# Precompiled Headers
44+
*.gch
45+
*.pch
46+
47+
# Compiled Dynamic libraries
48+
*.so
49+
*.dylib
50+
*.dll
51+
52+
# Fortran module files
53+
*.mod
54+
*.smod
55+
56+
# Compiled Static libraries
57+
*.lai
58+
*.la
59+
*.a
60+
*.lib
61+
62+
# Executables
63+
*.exe
64+
*.out
65+
*.app
66+
67+
# ---------------------------------------------------------------------------
68+
# https://github.com/github/gitignore/blob/master/CMake.gitignore
69+
70+
CMakeLists.txt.user
71+
CMakeCache.txt
72+
CMakeFiles
73+
CMakeScripts
74+
Testing
75+
Makefile
76+
cmake_install.cmake
77+
install_manifest.txt
78+
compile_commands.json
79+
CTestTestfile.cmake
80+
_deps
81+
82+
# ---------------------------------------------------------------------------
83+
# https://github.com/github/gitignore/blob/master/Global/JetBrains.gitignore
84+
85+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
86+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
87+
88+
# User-specific stuff
89+
.idea/**/workspace.xml
90+
.idea/**/tasks.xml
91+
.idea/**/usage.statistics.xml
92+
.idea/**/dictionaries
93+
.idea/**/shelf
94+
95+
# AWS User-specific
96+
.idea/**/aws.xml
97+
98+
# Generated files
99+
.idea/**/contentModel.xml
100+
101+
# Sensitive or high-churn files
102+
.idea/**/dataSources/
103+
.idea/**/dataSources.ids
104+
.idea/**/dataSources.local.xml
105+
.idea/**/sqlDataSources.xml
106+
.idea/**/dynamic.xml
107+
.idea/**/uiDesigner.xml
108+
.idea/**/dbnavigator.xml
109+
110+
# Gradle
111+
.idea/**/gradle.xml
112+
.idea/**/libraries
113+
114+
# Gradle and Maven with auto-import
115+
# When using Gradle or Maven with auto-import, you should exclude module files,
116+
# since they will be recreated, and may cause churn. Uncomment if using
117+
# auto-import.
118+
# .idea/artifacts
119+
# .idea/compiler.xml
120+
# .idea/jarRepositories.xml
121+
# .idea/modules.xml
122+
# .idea/*.iml
123+
# .idea/modules
124+
# *.iml
125+
# *.ipr
126+
127+
# CMake
128+
cmake-build-*/
129+
130+
# Mongo Explorer plugin
131+
.idea/**/mongoSettings.xml
132+
133+
# File-based project format
134+
*.iws
135+
136+
# IntelliJ
137+
out/
138+
139+
# mpeltonen/sbt-idea plugin
140+
.idea_modules/
141+
142+
# JIRA plugin
143+
atlassian-ide-plugin.xml
144+
145+
# Cursive Clojure plugin
146+
.idea/replstate.xml
147+
148+
# Crashlytics plugin (for Android Studio and IntelliJ)
149+
com_crashlytics_export_strings.xml
150+
crashlytics.properties
151+
crashlytics-build.properties
152+
fabric.properties
153+
154+
# Editor-based Rest Client
155+
.idea/httpRequests
156+
157+
# Android studio 3.1+ serialized cache file
158+
.idea/caches/build_file_checksums.ser
159+
160+
# ---------------------------------------------------------------------------

fs/copy-dir/.idea/.gitignore

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

fs/copy-dir/.idea/.name

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

fs/copy-dir/.idea/copy-dir.iml

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

fs/copy-dir/.idea/misc.xml

+4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

fs/copy-dir/.idea/modules.xml

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

fs/copy-dir/CMakeLists.txt

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
cmake_minimum_required(VERSION 3.14)
2+
project(CopyDir)
3+
4+
set(CMAKE_CXX_STANDARD 17)
5+
6+
add_executable(CopyDir main.cc StrUtils.cc)

fs/copy-dir/REFERENCES.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
- [windows - How to use C++ to Copy A Directory - Stack Overflow](https://stackoverflow.com/questions/14378192/how-to-use-c-to-copy-a-directory)
2+
3+
- [C++ Copy directory recursive under unix - Stack Overflow](https://stackoverflow.com/questions/36428121/c-copy-directory-recursive-under-unix)
4+
5+
- [What is the effect of extern "C" in C++? - Stack Overflow](https://stackoverflow.com/questions/1041866/what-is-the-effect-of-extern-c-in-c)
6+
7+
- [c - How avoid using global variable when using nftw - Stack Overflow](https://stackoverflow.com/questions/10281198/how-avoid-using-global-variable-when-using-nftw)
8+
9+
- [c++ - What does the thread_local mean in C++11? - Stack Overflow](https://stackoverflow.com/questions/11983875/what-does-the-thread-local-mean-in-c11)

fs/copy-dir/StrUtils.cc

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#include <codecvt>
2+
#include <locale>
3+
#include <cassert>
4+
#include <algorithm>
5+
#include <cctype>
6+
#include <regex>
7+
#include "StrUtils.hpp"
8+
9+
void StrUtils::ToStdWString(std::string const &src, std::wstring &dst) {
10+
dst = ToStdWString(src);
11+
}
12+
13+
std::wstring StrUtils::ToStdWString(std::string const &src) {
14+
#ifdef __APPLE__
15+
using cvt_t = std::codecvt_utf8<wchar_t>;
16+
#elif __GNUC__
17+
#elif _MSC_VER
18+
using cvt_t = std::codecvt_utf8_utf16<wchar_t>;
19+
#else
20+
#error "Your compiler is not supported"
21+
#endif
22+
return std::wstring_convert<cvt_t>().from_bytes(src);
23+
}
24+
25+
void StrUtils::ToStdString(std::wstring const &src, std::string &dst) {
26+
dst = ToStdString(src);
27+
}
28+
29+
std::string StrUtils::ToStdString(std::wstring const &src) {
30+
#ifdef __APPLE__
31+
using cvt_t = std::codecvt_utf8<wchar_t>;
32+
#elif __GNUC__
33+
#elif _MSC_VER
34+
using cvt_t = std::codecvt_utf8_utf16<wchar_t>;
35+
#else
36+
#error "Your compiler is not supported"
37+
#endif
38+
return std::wstring_convert<cvt_t>().to_bytes(src);
39+
}

fs/copy-dir/StrUtils.hpp

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#pragma once
2+
3+
#include <string>
4+
5+
struct StrUtils {
6+
7+
static void ToStdWString(std::string const &src, std::wstring &dst);
8+
static std::wstring ToStdWString(std::string const &src);
9+
static void ToStdString(std::wstring const &src, std::string &dst);
10+
static std::string ToStdString(std::wstring const &src);
11+
12+
StrUtils() = delete;
13+
StrUtils(StrUtils const &) = delete;
14+
StrUtils & operator=(StrUtils const &) = delete;
15+
StrUtils(StrUtils &&) = delete;
16+
StrUtils & operator=(StrUtils &&) = delete;
17+
~StrUtils() = default;
18+
19+
};

fs/copy-dir/a/a1.txt

Whitespace-only changes.

fs/copy-dir/a/a2.json

Whitespace-only changes.

fs/copy-dir/a/aa/aa1.txt

Whitespace-only changes.

fs/copy-dir/a/aa/aaa/aaa1.txt

Whitespace-only changes.

fs/copy-dir/a/aa/aaa/aaa2.txt

Whitespace-only changes.

fs/copy-dir/a/ab/ab1.json

Whitespace-only changes.

fs/copy-dir/a/ab/ab2.txt

Whitespace-only changes.

fs/copy-dir/b/a1.txt

Whitespace-only changes.

fs/copy-dir/b/a2.json

Whitespace-only changes.

fs/copy-dir/b/aa/aa1.txt

Whitespace-only changes.

fs/copy-dir/b/aa/aaa/aaa1.txt

Whitespace-only changes.

fs/copy-dir/b/aa/aaa/aaa2.txt

Whitespace-only changes.

fs/copy-dir/b/ab/ab1.json

Whitespace-only changes.

fs/copy-dir/b/ab/ab2.txt

Whitespace-only changes.

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/gusenov/examples-cpp/commit/2cd0abe15bf534c917bcfbca70694daaa19c4612

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy