Skip to content

Commit 8ad69a7

Browse files
committed
Use vsg::Path() instead of std::find_last_of() to extract the filename from a path
1 parent 67c84d5 commit 8ad69a7

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

examples/app/vsgshadertoy/vsgshadertoy.cpp

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ void mainImage( out vec4 fragColor, in vec2 fragCoord )
8686
}
8787
)";
8888

89-
// The default shader is composed of three dancing spheres
9089
string shaderToyToFragmentShader(const string& toyShader)
9190
{
9291
return R"(
@@ -257,15 +256,9 @@ int main(int argc, char** argv)
257256
}
258257
else {
259258
toyShader = readFile(argv[1]);
260-
string title;
261-
// extract the filename from the path
262-
auto pos = string(argv[1]).find_last_of("/");
263-
if (pos != string::npos)
264-
title = string(argv[1]).substr(pos+1);
265-
else
266-
title = argv[1];
267-
268-
windowTraits->windowTitle = title;
259+
vsg::Path filePath(argv[1]);
260+
261+
windowTraits->windowTitle = vsg::simpleFilename(filePath) + vsg::fileExtension(filePath);
269262
}
270263

271264

0 commit comments

Comments
 (0)