Page 1 of 1

Project Tree Import

Posted: Mon Jan 26, 2009 2:50 pm
by mgag
When creating a Workspace, when specfying the directories, it would be nice to be able to specify a file to import. The file would be a list of directories. Optionally, the list could be directories and file specifications, including wildcards. My project has 100s of directories of which ~60 make a Workspace - manually selecting these directories is tiresome. I have to select these for each Workspace in each clientspace I have.

Posted: Mon Jan 26, 2009 10:05 pm
by jussij
Have you tried building the workspace using the Workspace, Workspace Builder menu :?:

Cheers Jussi

PS: It is very easy to create a Zeus Workspace form a list of files: http://www.zeusedit.com/forum/viewtopic.php?t=39

Posted: Tue Jan 27, 2009 3:47 pm
by mgag
Yes I have used the workspace builder. Out of ~200 directories, I only need ~60, so I have to manually select these, or let the Builder find them all, and delete the ones I don't need (worse option). I would prefereably like to populate a list from a text file listing the directories and full paths (much like the Builder lists them). Since the builder seems to create a list like this, I thought it would be ~simple to add an import button which would ask for a file and then read in that list.

The manual approach seems wrose than using the builder...

Posted: Tue Jan 27, 2009 11:25 pm
by jussij
The manual approach seems worse than using the builder...
It is a fairly straight forward exercise:

Step #1: Given that this is an empty Zeus project:

Code: Select all

<Project name="Put your project name here" sorted="Yes">
    <Folder name="A Folder for My Files" sorted="Yes">
    </Folder>
</Project>
Step #2: Assuming the list of all your files looks something like this:

Code: Select all

D:\temp\file01.lua
D:\temp\file02.lua
D:\temp\file03.lua
D:\temp\file04.lua
D:\temp\file05.lua
D:\temp\file06.lua
D:\temp\file07.lua
D:\temp\file08.lua
D:\temp\file09.lua
D:\temp\file10.lua
D:\temp\file11.lua
Step #3: All you need to do is convert the list to look like this using either a simple Zeus keyboard macro or a couple of column copy and pastes:

Code: Select all

<file>D:\temp\file01.lua</file>
<file>D:\temp\file02.lua</file>
<file>D:\temp\file03.lua</file>
<file>D:\temp\file04.lua</file>
<file>D:\temp\file05.lua</file>
<file>D:\temp\file06.lua</file>
<file>D:\temp\file07.lua</file>
<file>D:\temp\file08.lua</file>
<file>D:\temp\file09.lua</file>
<file>D:\temp\file10.lua</file>
<file>D:\temp\file11.lua</file>
Step #4: Then copy and paste this list into the folder section of the project file to give you this:

Code: Select all

<Project name="Project Name Goes Here" sorted="Yes">
    <Folder name="My Files" sorted="Yes">
        <file>D:\temp\file01.lua</file>
        <file>D:\temp\file02.lua</file>
        <file>D:\temp\file03.lua</file>
        <file>D:\temp\file04.lua</file>
        <file>D:\temp\file05.lua</file>
        <file>D:\temp\file06.lua</file>
        <file>D:\temp\file07.lua</file>
        <file>D:\temp\file08.lua</file>
        <file>D:\temp\file09.lua</file>
        <file>D:\temp\file10.lua</file>
        <file>D:\temp\file11.lua</file>
    </Folder>
</Project>
Step #5: Finally open a workspace and use the Insert existing Project to workspace menu to add the newly created project file to the workspace.

It's hardly rocket science ;)

Cheers Jussi

Python Script to create Workspace

Posted: Fri Feb 06, 2009 3:45 pm
by mgag
If anyone is interested in the script to create a Workspace,

Code: Select all

import glob, os, fnmatch

def all_files( patterns, search_path, pathsep = os.pathsep):
    patterns = patterns.split(";")
    for path in os.walk(search_path):
        for pattern in patterns:
            for match in glob.glob(os.path.join(path[0], pattern)):
                yield match

file_FileList = open("fileList.txt", "w")
file_DirList = open("project_dirs.txt", "rU")

line_prefix = "        <file>"
line_suffix = "</file>\n"

file_FileList.write('<Project name="P4" sorted="Yes">\n')
file_FileList.write('    <Folder name="P4_WorkSpace" sorted="Yes">\n')

for line in file_DirList:  # line = directory path
    for match in all_files( search_path = line[:-1], patterns = "*.c;*.h", pathsep = "\n" ):
        file_FileList.write( line_prefix + match + line_suffix )

file_FileList.write('    </Folder>\n')
file_FileList.write('</Project>\n')

file_FileList.close()
file_DirList.close()

Re: Project Tree Import

Posted: Mon Jul 06, 2009 8:41 pm
by petar12345
mgag wrote:When creating a Workspace, when specfying the directories, it would be nice to be able to specify a file to import. The file would be a list of directories. Optionally, the list could be directories and file specifications, including wildcards. My project has 100s of directories of which ~60 make a Workspace - manually selecting these directories is tiresome. I have to select these for each Workspace in each clientspace I have.
You can edit project file project_name.zpi with Zeus editor.
It is fastest way to me.
You must not be in project "project_name" when edit project_name.zpi with Zeus.
Always make copy of project_name.zpi before and after editing.
If you make bad mistakes in project_name.zpi Zeus can erase all folder and files lines in it when you open project "project_name".
If that occur, close project "project_name". Copy saved project_name.zpi to original project folder. Correct mistakes. Save to original project folder and make copy of new project_name.zpi. Open project with Zeus editor.

Posted: Mon Jul 06, 2009 10:13 pm
by jussij
Hi Petar,

Your checklist is very accurate. It is exactly what I do when I need to make a change to the project :)

The only thing I can add is to get the name of the project/workspace file I just select the Workspace panel, select the project or workspace item and then use the right mouse click, Copy name(s) to clipboard menu to get the name of the file ;)

Cheers Jussi

Posted: Mon Dec 14, 2009 1:43 am
by jussij
This latest release adds the ability to drag and drop files and folders from the Windows Explorer onto any project node of the workspace.

This latest release can be found here: http://www.zeusedit.com/forum/viewtopic.php?p=5306

Cheers Jussi

Posted: Mon Dec 21, 2009 6:52 pm
by mgag
I will give this feature a try sometime.

I wrote a python script to create Zeus Workspace projects and I have tried to upload it a few times but it gets blocked by the spam guard.

Posted: Tue Dec 22, 2009 12:17 am
by jussij
I wrote a python script to create Zeus Workspace projects and I have tried to upload it a few times but it gets blocked by the spam guard.
Could you try posting this again to the Scripts section of the forum :?:

I have made a few changes that should hopefully mean it no longer gets blocked by the spam filter ;)

If it does stil fail, them send me the message text and script as an e-mail I will use it to fix the spam filter.

Cheers Jussi