TkN 2.7
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
28public:
30 virtual ~tksystem() = default;
31
33 static tksystem *the_tksystem();
34
35 int getdir (tkstring _dir, std::vector<tkstring> &_files);
36 void list_files(const tkstring &_dir, const tkstring &_pattern);
37 std::vector<tkstring> get_list_of_files(const tkstring &_dir, const tkstring &_pattern="*");
38
39 bool exists(tkstring _file_name);
40
41 int move(const tkstring &_from, const tkstring &_to);
42
43 int remove_dir(const tkstring &_dirname, bool _force = false);
44 int remove_file(const tkstring &_filename, bool _force = false);
45 int make_dir(const tkstring &_dirname, bool _recursive = true);
46
47 int unzip_file(const tkstring &_filename, tkstring _outputdir="");
48
49 int ls_dir(const tkstring &_dirname, tkstring _option="-l");
50
51 int download_file(const tkstring &_filename, const tkstring &_outputdir="", bool _replace_existing = false, bool _use_filename=false);
52
54
55#ifdef HAS_ROOT
57 ClassDef(tksystem,0);
58#endif
59};
60}
61
62#define gsystem (tkn::tksystem::the_tksystem())
63
64#endif
std::string with usefull tricks from TString (ROOT) and KVString (KaliVeda) and more....
Definition tkstring.h:33
int make_dir(const tkstring &_dirname, bool _recursive=true)
Definition tksystem.cpp:127
bool exists(tkstring _file_name)
Definition tksystem.cpp:66
int unzip_file(const tkstring &_filename, tkstring _outputdir="")
Definition tksystem.cpp:138
int remove_file(const tkstring &_filename, bool _force=false)
Definition tksystem.cpp:121
std::vector< tkstring > get_list_of_files(const tkstring &_dir, const tkstring &_pattern="*")
Definition tksystem.cpp:103
static tksystem * the_tksystem()
db_manager is a singleton
Definition tksystem.cpp:35
int remove_dir(const tkstring &_dirname, bool _force=false)
Definition tksystem.cpp:115
int ls_dir(const tkstring &_dirname, tkstring _option="-l")
Definition tksystem.cpp:144
int getdir(tkstring _dir, std::vector< tkstring > &_files)
Definition tksystem.cpp:44
int move(const tkstring &_from, const tkstring &_to)
Definition tksystem.cpp:133
void list_files(const tkstring &_dir, const tkstring &_pattern)
Definition tksystem.cpp:95
int download_file(const tkstring &_filename, const tkstring &_outputdir="", bool _replace_existing=false, bool _use_filename=false)
Definition tksystem.cpp:149
virtual ~tksystem()=default
tkstring get_system_command_output(tkstring command)
Definition tksystem.cpp:163
Definition tklog.cpp:16