本文整理汇总了C++中FileHandle::nameWithoutExtension方法的典型用法代码示例。如果您正苦于以下问题:C++ FileHandle::nameWithoutExtension方法的具体用法?C++ FileHandle::nameWithoutExtension怎么用?C++ FileHandle::nameWithoutExtension使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileHandle
的用法示例。
在下文中一共展示了FileHandle::nameWithoutExtension方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testAbsolute
//.........这里部分代码省略.........
handle.child("meow").mkdirs();
handle.list(handles);
if(handles.size() != 1)
fail();
FileHandle child = handles[0];
if(child.name() != "meow")
fail();
if(!child.parent().exists())
fail();
if(!handle.removeRecursive())
fail();
if(handle.exists())
fail();
std::ofstream output;
handle.write(false, output);
output << "moo";
output.close();
if(!handle.exists())
fail();
if(handle.length() != 3)
fail();
FileHandle copy = Gdx.files->absoluteHandle(path + "-copy");
copy.remove();
if(copy.exists())
fail();
handle.copyTo(copy);
if(!copy.exists())
fail();
if(copy.length() != 3)
fail();
FileHandle move = Gdx.files->absoluteHandle(path + "-move");
move.remove();
if(move.exists())
fail();
copy.moveTo(move);
if(!move.exists())
fail();
if(move.length() != 3)
fail();
move.removeRecursive();
if(move.exists())
fail();
std::ifstream input;
handle.read(input);
char bytes[7];
input.read(bytes, 3);
bytes[3] = 0;
if(strcmp("moo", bytes))
fail();
input.close();
handle.write(true, output);
output << "cow";
output.close();
if(handle.length() != 6)
fail();
handle.readBytes((unsigned char*)bytes, 6);
bytes[6] = 0;
if(strcmp("moocow", bytes))
fail();
if(handle.isDirectory()) fail();
std::vector<FileHandle> files;
handle.list(files);
if(files.size() != 0)
fail();
if(handle.name() != "meow")
fail();
if(handle.nameWithoutExtension() != "meow")
fail();
if(handle.extension() != "")
fail();
handle.remove();
if(handle.exists())
fail();
if(handle.isDirectory())
fail();
handle.remove();
handle.removeRecursive();
}
示例2: testInternal
void FilesTest::testInternal()
{
FileHandle handle = Gdx.files->internalHandle("data/badlogic.jpg");
if(!handle.exists())
fail();
if(handle.isDirectory())
fail();
try
{
handle.remove();
fail();
}
catch(GdxRuntimeException expected)
{
}
std::vector<FileHandle> files;
handle.list(files);
if(files.size() != 0)
fail();
if(!handle.parent().exists())
fail();
try
{
std::ifstream input;
handle.read(input);
input.close();
//TODO: why???
fail();
}
catch(GdxRuntimeException ignored)
{
}
FileHandle dir;
dir = Gdx.files->internalHandle("data");
if(!dir.exists())
fail();
if(!dir.isDirectory())
fail();
dir.list(files);
if(files.size() == 0)
fail();
FileHandle child = dir.child("badlogic.jpg");
if(child.name() != "badlogic.jpg")
fail();
if(child.nameWithoutExtension() != "badlogic")
fail();
if(child.extension() != "jpg")
fail();
if(!child.parent().exists())
fail();
FileHandle copy = Gdx.files->externalHandle("badlogic.jpg-copy");
copy.remove();
if(copy.exists())
fail();
handle.copyTo(copy);
if(!copy.exists())
fail();
if(copy.length() != 68465)
fail();
copy.remove();
if(copy.exists())
fail();
}