-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFileUtils.hpp
More file actions
35 lines (30 loc) · 968 Bytes
/
Copy pathFileUtils.hpp
File metadata and controls
35 lines (30 loc) · 968 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
//
// FileUtils.hpp
// cpplibs
//
// Created by Sean Grimes on 12/7/15.
// Copyright © 2015 Sean Grimes. All rights reserved.
//
#ifndef FileUtils_hpp
#define FileUtils_hpp
#include <string>
#include <fstream>
#include <vector>
#include <sys/stat.h>
#include <fcntl.h>
#include <dirent.h>
#include <cstring>
#include <unistd.h>
#include "StrUtils.hpp"
class FileUtils{
public:
static std::string readFullFile(const std::string &fileName);
static std::vector<std::string> readLineByLine(const std::string &fileName);
static size_t lineCount(const char *fname);
static std::vector<std::string> getFilesInDir(const std::string &dirPath, std::string ext = "");
static std::vector<std::string> getDirsInDir(const std::string &path);
static bool isFile(const std::string &path);
static bool isDir(const std::string &path);
static bool ends_with_string(const std::string &str, const std::string &what);
};
#endif /* FileUtils_hpp */