OSDN Git Service

Merge pull request #3279 from habu1010/feature/display-etc-screen-on-center
[hengbandforosx/hengbandosx.git] / src / io / record-play-movie.cpp
index 29627d9..2d87c29 100644 (file)
@@ -352,21 +352,21 @@ void prepare_movie_hooks(PlayerType *player_ptr)
         return;
     }
 
-    char buf[1024];
-    path_build(buf, sizeof(buf), ANGBAND_DIR_USER, movie_filename);
-    auto fd = fd_open(buf, O_RDONLY);
+    const auto &path = path_build(ANGBAND_DIR_USER, movie_filename);
+    const auto &filename = path.string();
+    auto fd = fd_open(filename, O_RDONLY);
     if (fd >= 0) {
         (void)fd_close(fd);
         std::string query = _("現存するファイルに上>書きしますか? (", "Replace existing file ");
-        query.append(buf);
+        query.append(filename);
         query.append(_(")", "? "));
         if (!get_check(query)) {
             return;
         }
 
-        movie_fd = fd_open(buf, O_WRONLY | O_TRUNC);
+        movie_fd = fd_open(filename, O_WRONLY | O_TRUNC);
     } else {
-        movie_fd = fd_make(buf);
+        movie_fd = fd_make(filename);
     }
 
     if (!movie_fd) {
@@ -654,9 +654,8 @@ void browse_movie(void)
 #ifndef WINDOWS
 void prepare_browse_movie_with_path_build(std::string_view filename)
 {
-    char buf[1024];
-    path_build(buf, sizeof(buf), ANGBAND_DIR_USER, filename);
-    movie_fd = fd_open(buf, O_RDONLY);
+    const auto &path = path_build(ANGBAND_DIR_USER, filename);
+    movie_fd = fd_open(path.string(), O_RDONLY);
     init_buffer();
 }
 #endif