diff options
| author | Carl Hetherington <cth@carlh.net> | 2013-09-19 21:39:01 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2013-09-19 21:39:01 +0100 |
| commit | cd6fd2ab18bdc1364ede3a33773df4e3ad719efa (patch) | |
| tree | ca7007518c890a37f2dd85493e7ee5ce27ffc4a0 /src/lib/util.cc | |
| parent | 8446a529b08d754c7ffe968baef54e5c115c26a5 (diff) | |
Various KDM and encryption fixes.
Diffstat (limited to 'src/lib/util.cc')
| -rw-r--r-- | src/lib/util.cc | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/lib/util.cc b/src/lib/util.cc index b8bc1fc9e..4e4493ac7 100644 --- a/src/lib/util.cc +++ b/src/lib/util.cc @@ -800,3 +800,18 @@ valid_image_file (boost::filesystem::path f) return (ext == ".tif" || ext == ".tiff" || ext == ".jpg" || ext == ".jpeg" || ext == ".png" || ext == ".bmp" || ext == ".tga"); } +string +tidy_for_filename (string f) +{ + string t; + for (size_t i = 0; i < f.length(); ++i) { + if (isalpha (f[i]) || f[i] == '_' || f[i] == '-') { + t += f[i]; + } else { + t += '_'; + } + } + + return t; +} + |
