Skip to content

Commit

Permalink
Fix utf8 paths
Browse files Browse the repository at this point in the history
  • Loading branch information
Rafiuth committed Sep 22, 2021
1 parent a8270b8 commit 97d7e60
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 2 additions & 4 deletions SpotifyOggDumper/SpotifyOggDumper.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;SPOTIFYOGGDUMPER_EXPORTS;_WINDOWS;_USRDLL;_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_DEBUG;SPOTIFYOGGDUMPER_EXPORTS;_WINDOWS;_USRDLL;_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING;_SILENCE_CXX20_U8PATH_DEPRECATION_WARNING;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpplatest</LanguageStandard>
</ClCompile>
Expand All @@ -85,7 +85,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;SPOTIFYOGGDUMPER_EXPORTS;_WINDOWS;_USRDLL;_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;NDEBUG;SPOTIFYOGGDUMPER_EXPORTS;_WINDOWS;_USRDLL;_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING;_SILENCE_CXX20_U8PATH_DEPRECATION_WARNING;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpplatest</LanguageStandard>
</ClCompile>
Expand Down Expand Up @@ -116,12 +116,10 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>

<ItemGroup>
<None Include="Data/config.json">
<Link>config.json</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>

</Project>
8 changes: 5 additions & 3 deletions SpotifyOggDumper/StateManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,9 @@ struct StateManagerImpl : public StateManager
coverArt->setData(TagLib::ByteVector(coverData.data(), (uint32_t)coverData.size()));

tag->addPicture(coverArt);
tag->setTitle(meta["name"].get<std::string>());
tag->setArtist(artists);
tag->setAlbum(meta["album"]["name"].get<std::string>());
tag->setTitle(TagLib::String(meta["name"].get<std::string>(), TagLib::String::UTF8));
tag->setArtist(TagLib::String(artists, TagLib::String::UTF8));
tag->setAlbum(TagLib::String(meta["album"]["name"].get<std::string>(), TagLib::String::UTF8));
tag->setTrack(meta["track_number"].get<int>());
tag->setYear(year);

Expand Down Expand Up @@ -324,6 +324,8 @@ struct StateManagerImpl : public StateManager
FillArg("{album_name}", metadata["album"]["name"]);
FillArg("{track_name}", metadata["name"]);
FillArg("{track_num}", std::to_string(metadata["track_number"].get<int>()));

return fs::u8path(ExpandEnvVars(fmt));
}
//Call WINAPI ExpandEnvironmentStrings(), assuming str is UTF8.
std::string ExpandEnvVars(const std::string& str)
Expand Down

0 comments on commit 97d7e60

Please sign in to comment.