TkN 2.4
Toolkit for Nuclei
Loading...
Searching...
No Matches
tksystem.h
1/********************************************************************************
2 * Copyright (c) : Université de Lyon 1, CNRS/IN2P3, UMR5822, *
3 * IP2I, F-69622 Villeurbanne Cedex, France *
4 * Normandie Université, ENSICAEN, UNICAEN, CNRS/IN2P3, *
5 * LPC Caen, F-14000 Caen, France *
6 * Contibutor(s) : *
7 * Jérémie Dudouet jeremie.dudouet@cnrs.fr [2020] *
8 * Diego Gruyer diego.gruyer@cnrs.fr [2020] *
9 * *
10 * Licensed under the MIT License <http://opensource.org/licenses/MIT>. *
11 * SPDX-License-Identifier: MIT *
12 ********************************************************************************/
13
14#ifndef tksystem_H
15#define tksystem_H
16
17#include "tkn_config.h"
18
19#ifdef HAS_ROOT
20#include "TClass.h"
21#endif
22
23#include "tkstring.h"
24
25namespace tkn {
26
28
29
30protected:
31 static tksystem *g_tksystem;
32
33public:
35 virtual ~tksystem() = default;
36
38 static tksystem *the_tksystem();
39
40 int getdir (tkstring _dir, std::vector<tkstring> &_files);
41 void list_files(const tkstring &_dir, const tkstring &_pattern);
42 std::vector<tkstring> get_list_of_files(const tkstring &_dir, const tkstring &_pattern="*");
43
44 bool exists(tkstring _file_name);
45
46 int move(const tkstring &_from, const tkstring &_to);
47
48 int remove_dir(const tkstring &_dirname, bool _force = false);
49 int remove_file(const tkstring &_filename, bool _force = false);
50 int make_dir(const tkstring &_dirname, bool _recursive = true);
51
52 int unzip_file(const tkstring &_filename, tkstring _outputdir="");
53
54 int ls_dir(const tkstring &_dirname, tkstring _option="-l");
55
56 int download_file(const tkstring &_filename, const tkstring &_outputdir="", bool _replace_existing = false, bool _use_filename=false);
57
59
60#ifdef HAS_ROOT
62 ClassDef(tksystem,0);
63#endif
64};
65}
66
67#define gsystem (tkn::tksystem::the_tksystem())
68
69#endif
std::string with usefull tricks from TString (ROOT) and KVString (KaliVeda) and more....
Definition tkstring.h:31
int make_dir(const tkstring &_dirname, bool _recursive=true)
Definition tksystem.cpp:128
bool exists(tkstring _file_name)
Definition tksystem.cpp:67
int unzip_file(const tkstring &_filename, tkstring _outputdir="")
Definition tksystem.cpp:139
int remove_file(const tkstring &_filename, bool _force=false)
Definition tksystem.cpp:122
std::vector< tkstring > get_list_of_files(const tkstring &_dir, const tkstring &_pattern="*")
Definition tksystem.cpp:104
static tksystem * the_tksystem()
db_manager is a singleton
Definition tksystem.cpp:36
int remove_dir(const tkstring &_dirname, bool _force=false)
Definition tksystem.cpp:116
int ls_dir(const tkstring &_dirname, tkstring _option="-l")
Definition tksystem.cpp:145
int getdir(tkstring _dir, std::vector< tkstring > &_files)
Definition tksystem.cpp:45
int move(const tkstring &_from, const tkstring &_to)
Definition tksystem.cpp:134
void list_files(const tkstring &_dir, const tkstring &_pattern)
Definition tksystem.cpp:96
int download_file(const tkstring &_filename, const tkstring &_outputdir="", bool _replace_existing=false, bool _use_filename=false)
Definition tksystem.cpp:150
virtual ~tksystem()=default
tkstring get_system_command_output(tkstring command)
Definition tksystem.cpp:164
Definition tklog.cpp:16