VFolder* XLinuxLibrary::RetainFolder(const VFilePath &inFilePath, BundleFolderKind inKind) const
{
    VFilePath bundlePath=inFilePath;

    while(!bundlePath.MatchExtension(CVSTR("bundle"), true /*case sensitive*/) && bundlePath.IsValid())
        bundlePath=bundlePath.ToParent();

    if(!bundlePath.IsValid())
        return NULL;

	switch(inKind)
    {
    case kBF_BUNDLE_FOLDER :            // The folder hosting the bundle
        return new VFolder(bundlePath);
    
    case kBF_EXECUTABLE_FOLDER :        // The (platform related) folder of executable file 
        return new VFolder(VFilePath(bundlePath, CVSTR("Contents/Linux/"), FPS_POSIX));

    case kBF_RESOURCES_FOLDER:			// The folder of main resources
        return new VFolder(VFilePath(bundlePath, CVSTR("Contents/Resources/"), FPS_POSIX));

    default :
        bool RetainFolderMethod=false;
        xbox_assert(RetainFolderMethod); // Need a Linux Implementation !
    }

	return NULL;
}
void VHTTPServerProjectSettings::ResetToFactorySettings()
{
	SetListeningAddress (DEFAULT_LISTENING_ADDRESS);
	SetListeningPort (DEFAULT_LISTENING_PORT);
	SetAllowSSL (DEFAULT_ALLOW_SSL);
	SetSSLMandatory (DEFAULT_SSL_MANDATORY);
	SetListeningSSLPort (DEFAULT_LISTENING_SSL_PORT);
	SetSSLCertificatesFolderPath (DEFAULT_SSL_CERTIFICATE_FOLDER_PATH);
	SetWebFolderPath (DEFAULT_WEB_FOLDER_PATH);
	SetIndexPageName (DEFAULT_INDEX_PAGE_NAME);
	SetDefaultCharSet (DEFAULT_WEB_CHARSET);
	SetLogFormat (DEFAULT_LOG_FORMAT);
	SetLogFolderPath (VFilePath(DEFAULT_LOG_FILE_FOLDER_PATH));
	SetLogFileName (DEFAULT_LOG_FILE_NAME);
	fLogBackupFolderName.Clear();
	fLogBackupSettings.ResetToFactorySettings();
	fHostName.Clear();
#if HTTP_SERVER_USE_PROJECT_PATTERNS
	fProjectPattern.Clear();
#endif
	fRealm.Clear();
	fAuthType = AUTH_NONE;
	fResourcesVector.clear();
	fVirtualFoldersVector.clear();
	fLogTokensVector.clear();
	fProjectFolderPath.Clear();
	SetUseWALibVirtualFolder (true);
	SetEnableCache (DEFAULT_ENABLE_CACHE);
	SetCacheMaxSize (DEFAULT_CACHE_MAX_SIZE);
	SetCachedObjectMaxSize (DEFAULT_CACHED_OBJECT_MAX_SIZE);
	SetEnableCompression (DEFAULT_COMPRESSION_ENABLED);
	SetCompressionMinThreshold (DEFAULT_COMPRESSION_MIN_THRESHOLD);
	SetCompressionMaxThreshold (DEFAULT_COMPRESSION_MAX_THRESHOLD);
	SetEnableKeepAlive (DEFAULT_KEEP_ALIVE_ENABLED);
	SetKeepAliveTimeout (DEFAULT_KEEP_ALIVE_TIMEOUT);
	SetKeepAliveMaxConnections (DEFAULT_KEEP_ALIVE_MAX_CONNECTIONS);
	SetMaxIncomingDataSize (XBOX::MaxLongInt);

	Tell_SettingsChanged();
}
VHTTPServerProjectSettings::VHTTPServerProjectSettings (const XBOX::VValueBag *inBag, const XBOX::VString& inProjectFolderPath)
: fListeningAddress (DEFAULT_LISTENING_ADDRESS)
, fPort (DEFAULT_LISTENING_PORT)
, fAllowSSL (DEFAULT_ALLOW_SSL)
, fSSLMandatory (DEFAULT_SSL_MANDATORY)
, fSSLPort (DEFAULT_LISTENING_SSL_PORT)
, fSSLCertificatesFolderPath (DEFAULT_SSL_CERTIFICATE_FOLDER_PATH)
, fWebFolderPath (DEFAULT_WEB_FOLDER_PATH)
, fIndexPageName (DEFAULT_INDEX_PAGE_NAME)
, fDefaultCharSet (DEFAULT_WEB_CHARSET)
, fLogFormat (DEFAULT_LOG_FORMAT)
, fLogFolderPath ( VFilePath( DEFAULT_LOG_FILE_FOLDER_PATH))	// WARNING: DEFAULT_LOG_FILE_FOLDER_PATH is wrong ./Logs
, fLogFileName (DEFAULT_LOG_FILE_NAME)
, fLogBackupFolderName()
, fLogBackupSettings()
, fRealm()
, fAuthType (AUTH_NONE)
, fResourcesVector()
, fVirtualFoldersVector()
, fLogTokensVector()
, fProjectFolderPath (inProjectFolderPath)
, fUseWALibVirtualFolder (true)
, fEnableCache (DEFAULT_ENABLE_CACHE)
, fCacheMaxSize (DEFAULT_CACHE_MAX_SIZE)
, fCachedObjectMaxSize (DEFAULT_CACHED_OBJECT_MAX_SIZE)
, fEnableCompression (DEFAULT_COMPRESSION_ENABLED)
, fCompressionMinThreshold (DEFAULT_COMPRESSION_MIN_THRESHOLD)
, fCompressionMaxThreshold (DEFAULT_COMPRESSION_MAX_THRESHOLD)
, fEnableKeepAlive (DEFAULT_KEEP_ALIVE_ENABLED)
, fKeepAliveTimeout (DEFAULT_KEEP_ALIVE_TIMEOUT)
, fKeepAliveMaxConnections (DEFAULT_KEEP_ALIVE_MAX_CONNECTIONS)
, fMaxIncomingDataSize (XBOX::MaxLongInt)
, fSignal_SettingsChanged()
{
	LoadFromBag (inBag);
}