Exemplo n.º 1
0
static bool _BuildExecutablePath( const VFilePath &inPath, VFilePath& outExecutablePath)
{
	bool ok;
	if (inPath.IsFile())
	{
		outExecutablePath = inPath;
		ok = true;
	}
	else if (inPath.IsFolder())
	{
		// if path is a folder named truc.someextension,
		// look at truc.someextension\Contents\Windows\truc.dll
		
		// afabre : finally, we look the dll near the exe file
		VString name;
		inPath.GetName( name);
		outExecutablePath = inPath;
		outExecutablePath = outExecutablePath.ToParent().ToParent();
		outExecutablePath.SetFileName( name);
		outExecutablePath.SetExtension( CVSTR( "dll"));
		ok = true;
	}
	else
	{
		ok = false;
	}

	return ok;
}
Exemplo n.º 2
0
VFolder* XWinLibrary::RetainFolder(const VFilePath &inPath, BundleFolderKind inKind) const
{
	VFolder *folder = NULL;
	if (inPath.IsFile())
	{
		switch( inKind)
		{
			case kBF_BUNDLE_FOLDER:					// The folder hosting the bundle
			case kBF_EXECUTABLE_FOLDER:				// The folder of executable file (platform related)
				{
					VFilePath parent = inPath;
					folder = new VFolder( parent.ToParent());
				}

			default:
				assert( false);
				break;
		}
	}
	else if (inPath.IsFolder())
	{
		switch( inKind)
		{
			case kBF_BUNDLE_FOLDER:					// The folder hosting the bundle
				{
					VFilePath parent = inPath;
					folder = new VFolder( parent/*.ToParent()*/);
					break;
				}

			case kBF_EXECUTABLE_FOLDER:				// The folder of executable file (platform related)
				{
					VFilePath executablePath;
					if (_BuildExecutablePath( inPath, executablePath))
					{
						folder = new VFolder( executablePath.ToFolder());
					}
					break;
				}

			case kBF_RESOURCES_FOLDER:				// The folder of main resources
				{
					VFilePath path = inPath;
					path.ToSubFolder( CVSTR("Contents")).ToSubFolder( CVSTR( "Resources"));
					folder = new VFolder( path);
					break;
				}

			case kBF_LOCALISED_RESOURCES_FOLDER:	// The folder of prefered localization
			case kBF_PLUGINS_FOLDER:				// The folder for bundle's plugins
			case kBF_PRIVATE_FRAMEWORKS_FOLDER:		// The folder for private frameworks
			case kBF_PRIVATE_SUPPORT_FOLDER:		// The folder for private support files
			default:
				assert( false);
				break;
		}
	}
	return folder;
}