Github user achristianson commented on a diff in the pull request:
https://github.com/apache/nifi-minifi-cpp/pull/181#discussion_r150386373
--- Diff: libminifi/include/utils/FileSystemUtils.h ---
@@ -0,0 +1,122 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef LIBMINIFI_INCLUDE_UTILS_FILESYSTEMUTILS_H_
+#define LIBMINIFI_INCLUDE_UTILS_FILESYSTEMUTILS_H_
+
+#ifdef BOOST_VERSION
+#include <boost/filesystem.hpp>
+#else
+#include <cstdlib>
+#endif
+#include <cstdio>
+#include <unistd.h>
+#include <fcntl.h>
+#include "io/validation.h"
+#include "Id.h"
+#include "StringUtils.h"
+#ifdef WIN32
+#define stat _stat
+#endif
+
+namespace org {
+namespace apache {
+namespace nifi {
+namespace minifi {
+namespace utils {
+
+/**
+ * Simple implementation of some file system utilities.
+ *
+ * unique_file is not a static implementation so that we can support scope
driven temporary files.
+ */
+class FileSystemUtils {
+ public:
+
+ FileSystemUtils() {
+ }
+
+ ~FileSystemUtils() {
+ for (auto file : unique_files_) {
+ unlink(file.c_str());
+ }
+ }
+ std::string unique_file(const std::string &location, bool keep = false) {
+
+ if (!IsNullOrEmpty(location)) {
+ std::string file_name = location + "/" +
non_repeating_string_generator_.generate();
+ while (!verify_not_exist(file_name)) {
+ file_name = location + "/" +
non_repeating_string_generator_.generate();
+ }
+ if (!keep)
+ unique_files_.push_back(file_name);
+ return file_name;
--- End diff --
Return std::move()?
---