+ } else {
+ /*
+ * Create the snapshot directory if it does not exist.
+ *
+ * We can't just use trimFilename() because when applied to
+ * "/foo/boo/" it would merely return "/foo".
+ *
+ * XXX: create nested directories.
+ */
+ os::String prefix(snapshotPrefix);
+ os::String::iterator sep = prefix.rfindSep(false);
+ if (sep != prefix.end()) {
+ prefix.erase(sep, prefix.end());
+ if (!prefix.exists() && !os::createDirectory(prefix)) {
+ std::cerr << "error: failed to create `" << prefix.str() << "` directory\n";
+ }
+ }