1
0
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-18 03:09:13 +00:00

Deprecate plFileUtils and parts of pnUtPath

This commit is contained in:
2013-01-20 13:47:14 -08:00
parent 970ad3e729
commit 6e564476b7
114 changed files with 982 additions and 2117 deletions

View File

@ -42,7 +42,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "plResMgr/plResManager.h"
#include "plPageOptimizer.h"
#include "plFile/plFileUtils.h"
#include "pnNetCommon/plSynchedObject.h"
int main(int argc, char* argv[])
@ -53,7 +52,8 @@ int main(int argc, char* argv[])
return 1;
}
printf("Optimizing %s...", plFileUtils::GetFileName(argv[1]));
plFileName filename = argv[1];
printf("Optimizing %s...", filename.GetFileName().c_str());
#ifndef _DEBUG
try {

View File

@ -50,21 +50,18 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "pnFactory/plFactory.h"
#include "pnKeyedObject/plKeyImp.h"
#include "plFile/plFileUtils.h"
#include "hsStream.h"
plPageOptimizer* plPageOptimizer::fInstance = nil;
plPageOptimizer::plPageOptimizer(const char* pagePath) :
plPageOptimizer::plPageOptimizer(const plFileName& pagePath) :
fOptimized(true),
fPageNode(nil),
fPagePath(pagePath)
{
fInstance = this;
strcpy(fTempPagePath, fPagePath);
plFileUtils::StripExt(fTempPagePath);
strcat(fTempPagePath, "_opt.prp");
fTempPagePath = fPagePath.StripFileExt() + "_opt.prp";
fResMgr = (plResManager*)hsgResMgr::ResMgr();
}
@ -135,8 +132,8 @@ void plPageOptimizer::Optimize()
if (loaded)
IRewritePage();
uint32_t oldSize = plFileUtils::GetFileSize(fPagePath);
uint32_t newSize = plFileUtils::GetFileSize(fTempPagePath);
uint64_t oldSize = plFileInfo(fPagePath).FileSize();
uint64_t newSize = plFileInfo(fTempPagePath).FileSize();
if (!loaded)
{
@ -144,19 +141,19 @@ void plPageOptimizer::Optimize()
}
else if (fOptimized)
{
plFileUtils::RemoveFile(fTempPagePath);
plFileSystem::Unlink(fTempPagePath);
puts("already optimized.");
}
else if (oldSize == newSize)
{
plFileUtils::RemoveFile(fPagePath, true);
plFileUtils::FileMove(fTempPagePath, fPagePath);
plFileSystem::Unlink(fPagePath);
plFileSystem::Move(fTempPagePath, fPagePath);
puts("complete");
}
else
{
plFileUtils::RemoveFile(fTempPagePath);
plFileSystem::Unlink(fTempPagePath);
puts("failed. File sizes different");
}
}

View File

@ -44,6 +44,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "pnKeyedObject/plKey.h"
#include "pnKeyedObject/plUoid.h"
#include "plFileSystem.h"
#include <vector>
#include <set>
@ -63,8 +64,8 @@ protected:
bool fOptimized; // True after optimization if the page was already optimized
const char* fPagePath; // Path to our page
char fTempPagePath[512]; // Path to the temp output page
plFileName fPagePath; // Path to our page
plFileName fTempPagePath; // Path to the temp output page
plLocation fLoc; // Location of our page
plRegistryPageNode* fPageNode; // PageNode for our page
@ -78,7 +79,7 @@ protected:
void IRewritePage();
public:
plPageOptimizer(const char* pagePath);
plPageOptimizer(const plFileName& pagePath);
void Optimize();
};