Jump to content

Is it possible to add two data_path ?


photo

Recommended Posts

Hi, 

I would like to use two data path in my c++ project. 

For now I'm doing the following :

	int unigine_argc = argc + 2;//4;
	char **unigine_argv = new char *[unigine_argc];
	for (int i = 0; i < argc; i++){
		unigine_argv[i] = new char[strlen(argv[i])];
		strcpy(unigine_argv[i], argv[i]);
	}

	char* env_p;
	printf("%s","Adding data path arguments: \n" );
	env_p = std::getenv("AirfieldPath");
	unigine_argv[argc + 0] = strdup("-data_path");
	unigine_argv[argc + 1] = strdup(env_p);
	printf("%s\n",env_p);

	
	//unigine_argv[argc + 2] = strdup("-data_path");
	//env_p = std::getenv("AircraftPath");
	//unigine_argv[argc + 3] = strdup(env_p);
	//printf("%s\n", env_p);

The commented part are the ones I would like to add to my code.

Is there a way to do so ?

Link to comment

Hi Antoine,

No, you can't do that. Engine can work only with a single data directory at once.

You can use mounts to add some additional files into the current project. There is a snippet that allows to create mounts without physically creating .umount file inside data:

FileSystemMountPtr create_mount(const char *absolute_path,
	const char *virtual_path,
	int access)
{
	auto umount_filepath =
		String::extension(FileSystem::getVirtualPath(virtual_path), "umount");

	if (!FileSystem::addBlobFile(umount_filepath))
	{
		Log::error("can't create blob %s\n", umount_filepath.get());
		return {};
	}

	return FileSystem::createMount(absolute_path, virtual_path, access);
}

Thanks!

  • Like 1

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment
×
×
  • Create New...