Week 9 - Importing from the library
This week was focused on finishing the import of the new user library and to start working on some recap videos.
How importing works
I will explain how the new import works in the 2 different libraries, but first there are a few parts that are the same for now:
- As said in the previous week, it copies the files for the subtree and the actions into the new location.
- It uses the name provided to replace the name of the subtree
- For now, if there is an action with the same name it will not copy it. This will be optional in the future.
In the standard library
In the standard library it is simpler, because an entry consists of the following:
- Actions: can be multiple
- Tree: there can only be one, and it cannot contain any subtrees.
This makes the import mush easier, because it is just copying the files to the new location without much trouble.
In the user library
Here the complexity is much higher, because not all the actions are part of a given subtree, and not all subtrees are used inside the one from the library.
In order to solve this two problems, we need to read the json file containing the selected entry to find all used actions and if there are, all subtrees contained inside.
For the last part it is necessary to use recursion.
After solving this part and being able to list all actions and subtrees, there is another big issue remaining, the name of the subtrees:
If by chance, the selected tree contains one or more subtrees we need to set their name to a new value, because if not they will have the same name as they had in their original project. This has 2 possible solutions:
- Using the original project name as part of the new one. Like: my_project-subtreeName
- Using the entry name as part of the name. Like: my_name-subtreeName
Making recap videos
In the next post I will upload some videos demonstrating the imporvements done in this period of GSoC