Skip to content

Commit 9c80bd8

Browse files
authored
getDefaultUrl関数がUnreal環境でクラッシュする問題の解消 (Synesthesias#135)
1 parent 06ceb1f commit 9c80bd8

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

include/plateau/network/client.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ namespace plateau::network {
5555
DatasetFiles getFiles(const std::string& id) const;
5656
std::string download(const std::string& destination_directory_path, const std::string& url) const;
5757

58-
static std::string getDefaultServerUrl();
58+
static const std::string& getDefaultServerUrl();
5959

6060
private:
6161
std::string server_url_;

src/network/client.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ namespace plateau::network {
100100

101101
// '\\' を '/' に置換
102102
auto pos = url_str.find(u8'\\');
103-
while(pos != std::string::npos){
103+
while (pos != std::string::npos) {
104104
url_str.replace(pos, 1, u8"/");
105105
pos = url_str.find(u8'\\', pos + 1);
106106
}
@@ -123,7 +123,8 @@ namespace plateau::network {
123123
return gml_file_path.u8string();
124124
}
125125

126-
std::string Client::getDefaultServerUrl() {
127-
return "https://plateau-api-mock-v2.deta.dev";
126+
const std::string& Client::getDefaultServerUrl() {
127+
static const std::string default_server_url = "https://plateau-api-mock-v2.deta.dev";
128+
return default_server_url;
128129
}
129130
}

0 commit comments

Comments
 (0)