void VJSRequireClass::_Initialize (const VJSParms_initialize &inParms, void *)
{
	XBOX::VJSObject	thisObject(inParms.GetObject());
	XBOX::VJSArray	arrayObject(inParms.GetContext());
	XBOX::VFolder	*folder = XBOX::VFolder::RetainSystemFolder(eFK_Executable, false);

	xbox_assert(folder != NULL);	
	
#if VERSIONMAC
	
	XBOX::VFolder	*parentFolder = folder->RetainParentFolder();
	
	XBOX::VFilePath	path(parentFolder->GetPath(), "Modules/", FPS_POSIX);
	
	XBOX::ReleaseRefCountable<XBOX::VFolder>(&parentFolder);
	
#else
	
	XBOX::VFilePath	path(folder->GetPath(), "Modules/", FPS_POSIX);
	
#endif	

	XBOX::ReleaseRefCountable<XBOX::VFolder>(&folder);

	XBOX::VString	defaultPath;

	path.GetPosixPath(defaultPath);

	thisObject.SetProperty("paths", arrayObject, JS4D::PropertyAttributeDontDelete);
	arrayObject.PushString(defaultPath);
}
/* private */
void VVirtualFolder::_NormalizeFolder()
{
	assert (NULL != fFolder);

	if (!fFolder->Exists())
		fFolder->CreateRecursive();

	if (fFolder->Exists())
	{
		XBOX::VFilePath folderPath (fFolder->GetPath());
		XBOX::VFilePath indexPath;

		indexPath = folderPath.ToSubFile (fIndexFileName);

		if (indexPath.IsFile())
		{
			XBOX::VFile indexFile (indexPath);

			if (!indexFile.Exists())
			{
				XBOX::VFolder *componentFolder = VHTTPServer::RetainComponentFolder (kBF_RESOURCES_FOLDER);

				if (NULL != componentFolder)
				{
					XBOX::VFilePath		defaultIndexPath = componentFolder->GetPath();
					XBOX::DialectCode	dialectCode = XBOX::VIntlMgr::GetDefaultMgr()->GetCurrentDialectCode();
					XBOX::VString		languageCode;
					XBOX::VString		fileName;

					XBOX::VIntlMgr::GetDefaultMgr()->GetISO6391LanguageCode (dialectCode, languageCode);

					fileName.AppendCString ("index_");
					fileName.AppendString (languageCode);
					fileName.AppendCString (".html");

					defaultIndexPath.ToSubFolder (CVSTR ("Default Page")).ToSubFile (fileName);

					if (defaultIndexPath.IsFile())
					{
						XBOX::VFile defaultIndexFile (defaultIndexPath);

						if (defaultIndexFile.Exists())
							indexFile.CopyFrom (defaultIndexFile);
					}

					XBOX::QuickReleaseRefCountable (componentFolder);
				}
			}
		}
	}
}
void VJSModuleState::_GetRequireFunctionURL (XBOX::VString *outURLString)
{
	XBOX::VFolder	*folder = XBOX::VFolder::RetainSystemFolder(eFK_Executable, false);

	xbox_assert(folder != NULL);	
	
#if VERSIONMAC
	
	XBOX::VFolder	*parentFolder = folder->RetainParentFolder();
	
	XBOX::VFilePath	path(parentFolder->GetPath(), "Resources/Web Components/walib/WAF/Core/Native/requireFunction.js", FPS_POSIX);
	XBOX::VFile		file(path);

	if (!file.Exists()) {

		path.FromRelativePath(parentFolder->GetPath(), "walib/WAF/Core/Native/requireFunction.js", FPS_POSIX);

	}
	
	XBOX::ReleaseRefCountable<XBOX::VFolder>(&parentFolder);
	
#else
	
	XBOX::VFilePath	path(folder->GetPath(), "Resources/Web Components/walib/WAF/Core/Native/requireFunction.js", FPS_POSIX);
	XBOX::VFile		file(path);

	if (!file.Exists()) 

		path.FromRelativePath(folder->GetPath(), "walib/WAF/Core/Native/requireFunction.js", FPS_POSIX);
	
#endif	
	
	path.GetPosixPath(*outURLString);

	XBOX::ReleaseRefCountable<XBOX::VFolder>(&folder);
}