Ejemplo n.º 1
0
void FilePath::InitFromRelativePath(const String &relativePath, const String &folder)
{
    sourcePathname = folder + relativePath;
    SetRelativePath(relativePath, folder);
}
Ejemplo n.º 2
0
		/** reset from string
		* @see NPLFileName() for details.
		*/
		void FromString(const char* sFilePath){
			// for empty string, default to local Glia file.
			if(sFilePath[0] == '\0')
			{
				// FromString("(gl)script/empty.lua");
				sRuntimeStateName.clear();
				sNID.clear();
				sDNSServerName.clear();
				sRelativePath.clear();
				return;
			}

			int i = 0;
			int nNIDIndex = 0;
			int nRelativePathIndex;
			int nDNSServerIndex;

			bool bExplicitActivationType = false;
			/// get the activation type
			if(sFilePath[i] == '(')
			{
				bExplicitActivationType = true;
				i++;
				while( (sFilePath[i]!=')') && (sFilePath[i]!='\0'))
				{
					i++;
				}
				i++;
				if( !(i==4 && (sFilePath[1]=='g') && (sFilePath[2]=='l')) )
					sRuntimeStateName.assign(sFilePath+1, i-2);
				else
					sRuntimeStateName.clear();
				nNIDIndex = i;
			}

			/// get namespace
			while( (sFilePath[i]!=':') && (sFilePath[i]!='\0'))
				i++;

			if(sFilePath[i]=='\0')
			{
				sNID.clear();
				sRelativePath.assign(sFilePath+nNIDIndex, i-nNIDIndex);
				sDNSServerName.clear();
				return;
			}
			else 
			{
				if(i>nNIDIndex)
					sNID.assign(sFilePath+nNIDIndex, i-nNIDIndex);
				else
					sNID.clear();

				/// get relative path
				nRelativePathIndex = i+1;
				i++;
			}

			/// get relative path
			while( (sFilePath[i]!='@') && (sFilePath[i]!='\0') )
				i++;
			SetRelativePath(sFilePath+nRelativePathIndex, i - nRelativePathIndex);

			if(sFilePath[i]=='\0')
			{
				sDNSServerName.clear();
				return;
			}
			else 
				i++;

			/// get DNS server name
			nDNSServerIndex = i;

			while( sFilePath[i]!='\0')
				i++;
			sDNSServerName.assign(sFilePath+nDNSServerIndex, i - nDNSServerIndex);
		}
Ejemplo n.º 3
0
void FilePath::SetRelativePath(const String &relativePath)
{
    SetRelativePath(relativeFolder, FileSystem::Instance()->GetCurrentWorkingDirectory());
}