Resource name without extension to use as variable in external tools on Eclipse

In my last post about how to configure ns3 on Eclipse I gave the file name through a string prompt variable ("${string_prompt}"). This method is bored, for this reason I searched, how to give the file name without the extension automatically.
StartExplorer is a plugin for Eclipse and in their web, they mentioned the following:

In addition, StartExplorer itself offers a few variables of its own.

${resource_name_without_extension}: File name or directory name of the resource, without path and without extension (that is, resource, without trailing dot)

Also, the plugin Pathtool is another plugin with several variables.

I installed them using the MarketPlace client (see how to install marketplace on Eclipse CDT), but the variable that I want didn't appear in the variable list.




To automate the execution of my simulations, I created a bash script that calls waf (called wafEclipse) and parse the file name to remove the extension .cc
This is the wafEclipse code:

#!/bin/bash
wafPath="~/ns-allinone-3.25/ns-3.25/waf" # change it to your path
argument=$1
nameFile="`echo $argument | sed 's/\.cc$//'`" # removes .cc extension from argument
$wafPath --run $nameFile

Now, edit your external tools' program with the new executable and as argument puts "${resource_name}" (the file name with extension that our script recevies as argument).


Now, you can run your simulation just with one click.

Comments

Popular posts from this blog

from: can't read /var/mail/ in Python scripts

Fix "Set scan parameters failed: Input/output error" on Ubuntu 16.04

How to install a WhatsApp bot based on Python