Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 96cf8b1

Browse filesBrowse files
committed
added serperate fs utils folder
1 parent a0743fc commit 96cf8b1
Copy full SHA for 96cf8b1

File tree

4 files changed

+35
-10
lines changed
Filter options

4 files changed

+35
-10
lines changed

‎CMakeLists.txt

Copy file name to clipboardExpand all lines: CMakeLists.txt
+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ project(natcpp)
33

44
set(CMAKE_CXX_STANDARD 20)
55

6-
add_executable(natcpp main.cpp args/cli_args.cpp args/cli_args.h types.h utils/string_formatting/string_effects.cpp utils/string_formatting/string_effects.h utils/string_formatting/string_coloring.cpp utils/string_formatting/string_coloring.h)
6+
add_executable(natcpp main.cpp args/cli_args.cpp args/cli_args.h types.h utils/string_formatting/string_effects.cpp utils/string_formatting/string_effects.h utils/string_formatting/string_coloring.cpp utils/string_formatting/string_coloring.h utils/fs/handle_files.cpp utils/fs/handle_files.h)

‎main.cpp

Copy file name to clipboardExpand all lines: main.cpp
+3-9
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,14 @@
1+
//#include <filesystem>
2+
//#include <vector>
13
#include <iostream>
2-
#include <vector>
34
#include <string>
4-
#include <filesystem>
55
#include "args/cli_args.h"
66
#include "types.h"
77
#include "utils/string_formatting/string_effects.h"
88
#include "utils/string_formatting/string_coloring.h"
9+
#include "utils/fs/handle_files.h"
910
namespace fs = std::filesystem;
1011

11-
std::vector<fs::directory_entry> get_files(const std::string& dir_name) {
12-
std::vector<fs::directory_entry> res = {};
13-
for (const auto& f : fs::directory_iterator(dir_name))
14-
res.push_back(f);
15-
return res;
16-
}
17-
1812
int main(int argc, char* argv[]) {
1913
auto args = parse_args();
2014
auto f = get_files(".");

‎utils/fs/handle_files.cpp

Copy file name to clipboard
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//
2+
// Created by Will Lane on 2/3/21.
3+
//
4+
5+
#include "handle_files.h"
6+
#include <filesystem>
7+
#include <vector>
8+
#include <string>
9+
namespace fs = std::filesystem;
10+
11+
std::vector<fs::directory_entry> get_files(const std::string& dir_name) {
12+
std::vector<fs::directory_entry> res = {};
13+
for (const auto& f : fs::directory_iterator(dir_name))
14+
res.push_back(f);
15+
return res;
16+
}

‎utils/fs/handle_files.h

Copy file name to clipboard
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//
2+
// Created by Will Lane on 2/3/21.
3+
//
4+
5+
#ifndef NATCPP_HANDLE_FILES_H
6+
#define NATCPP_HANDLE_FILES_H
7+
8+
#include <filesystem>
9+
#include <vector>
10+
#include <string>
11+
namespace fs = std::filesystem;
12+
13+
std::vector<fs::directory_entry> get_files(const std::string&);
14+
15+
#endif //NATCPP_HANDLE_FILES_H

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.