OSDN Git Service

[Refactor] prepare_browse_movie_without_path_build() の引数をstring_view からpath に差し替えた
authorHourier <66951241+Hourier@users.noreply.github.com>
Thu, 11 May 2023 11:32:44 +0000 (20:32 +0900)
committerHourier <66951241+Hourier@users.noreply.github.com>
Sat, 13 May 2023 12:56:33 +0000 (21:56 +0900)
src/io/record-play-movie.cpp
src/io/record-play-movie.h
src/main-win.cpp

index c483913..25e0aaa 100644 (file)
@@ -623,9 +623,9 @@ static bool flush_ringbuf_client()
     return true;
 }
 
-void prepare_browse_movie_without_path_build(std::string_view filename)
+void prepare_browse_movie_without_path_build(const std::filesystem::path &path)
 {
-    movie_fd = fd_open(filename, O_RDONLY);
+    movie_fd = fd_open(path, O_RDONLY);
     init_buffer();
 }
 
@@ -655,7 +655,7 @@ void browse_movie(void)
 void prepare_browse_movie_with_path_build(std::string_view filename)
 {
     const auto &path = path_build(ANGBAND_DIR_USER, filename);
-    movie_fd = fd_open(path.string(), O_RDONLY);
+    movie_fd = fd_open(path, O_RDONLY);
     init_buffer();
 }
 #endif
index ec6a2fc..30332e4 100644 (file)
@@ -1,10 +1,11 @@
 #pragma once
 
+#include <filesystem>
 #include <string_view>
 
 class PlayerType;
 void prepare_movie_hooks(PlayerType *player_ptr);
-void prepare_browse_movie_without_path_build(std::string_view filename);
+void prepare_browse_movie_without_path_build(const std::filesystem::path &path);
 void browse_movie();
 #ifndef WINDOWS
 void prepare_browse_movie_with_path_build(std::string_view filename);
index 2520fbc..7e021ab 100644 (file)
@@ -1675,7 +1675,7 @@ static void process_menus(PlayerType *player_ptr, WORD wCmd)
             const auto &filename = get_open_filename(&ofn, ANGBAND_DIR_USER, savefile, MAIN_WIN_MAX_PATH);
             if (filename.has_value()) {
                 savefile = filename.value();
-                prepare_browse_movie_without_path_build(savefile.string());
+                prepare_browse_movie_without_path_build(savefile);
                 movie_in_progress = true;
             }
         }