Vlasiator
ebf0dd394 on dev (v5.4.0 + 1054 commits)
Loading...
Searching...
No Matches
vlsv_util.cpp
Go to the documentation of this file.
1
/*
2
* This file is part of Vlasiator.
3
* Copyright 2010-2016 Finnish Meteorological Institute
4
*
5
* For details of usage, see the COPYING file and read the "Rules of the Road"
6
* at http://www.physics.helsinki.fi/vlasiator/
7
*
8
* This program is free software; you can redistribute it and/or modify
9
* it under the terms of the GNU General Public License as published by
10
* the Free Software Foundation; either version 2 of the License, or
11
* (at your option) any later version.
12
*
13
* This program is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU General Public License for more details.
17
*
18
* You should have received a copy of the GNU General Public License along
19
* with this program; if not, write to the Free Software Foundation, Inc.,
20
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21
*
22
* File: vlsv_util.cpp
23
* Author: sandroos
24
*
25
* Created on July 6, 2015, 12:56 PM
26
*/
27
28
#include <cstdlib>
29
#include <iostream>
30
#include <glob.h>
31
32
#include "
vlsv_util.h
"
33
34
using namespace
std;
35
36
std::vector<std::string>
toolutil::getFiles
(
const
std::string& mask) {
37
vector<string> fileList;
38
39
glob_t glob_matches;
40
int
retval = glob(mask.c_str(), GLOB_TILDE_CHECK, NULL, &glob_matches);
41
if
(retval != 0) {
42
switch
(retval) {
43
case
GLOB_NOSPACE:
44
cerr <<
"ERROR enumerating filenames: out of memory in "
<< __FILE__ <<
":"
<< __LINE__ << endl;
45
break
;
46
case
GLOB_ABORTED:
47
cerr <<
"ERROR in reading directory contents in "
<< __FILE__ <<
":"
<< __LINE__ << endl;
48
break
;
49
case
GLOB_NOMATCH:
50
cerr <<
"ERROR: no matching file found for pattern "
<< mask << endl;
51
break
;
52
}
53
globfree(&glob_matches);
54
return
fileList;
55
}
56
for
(
unsigned
int
i
=0;
i
<glob_matches.gl_pathc;
i
++) {
57
fileList.push_back(glob_matches.gl_pathv[
i
]);
58
}
59
60
globfree(&glob_matches);
61
return
fileList;
62
}
i
for i
Definition
Dispersion.m:24
toolutil::getFiles
std::vector< std::string > getFiles(const std::string &mask)
Definition
vlsv_util.cpp:36
vlsv_util.h
tools
vlsv_util.cpp
Generated on
for Vlasiator by
1.16.1