How to get current folder basename in vscode tasks and launch file? - visual-studio-code

I wanna make a C++ program that will all of its code into the an executable file with the current folder name. And this is because I wanna make a project like thing. And the project name is the current folder name and that's why I want the executable to be named with the current folder. But ${fileDirname} variable prints the whole path instead of the basename of the folder. Of course, I can use make file to build them, but the lauch file requires the executable file name, and I can't put the folder name there. And I don't want to change this launch.json for every project. Please help me!!

Related

Setting up Stat-ET Sweave for the first time

I've been following the Getting started with Sweave guide and created a new project folder called MISC with a subfolder called Sweave.
I've placed my sample .Rnw file in this folder together with a copy of the Sweave.sty file.
I then changed my R working directory to MISC\Sweave.
Sweave does create the TEX file without problems, but then complains:
Project output file format not set in project
I've checked the project properties and I can't quite work out where I should set it. Any ideas?
P.S.: Does this mean that I will have to set this up for every single project I want to Sweave?
Since your .tex file is located in a folder within your project folder, you will have to add the directory/folder name to your specified .tex and .pdf filenames.
Under the Project Properties > Latex Project Properties for your 'MISC' project folder, the first text box, Main TeX File, should be something like '/Sweave/myfile.tex' where 'myfile.tex' is the name of your Sweave document with the .tex extension.
The directory path should also be added to the name of your Output File in the second textbox: e.x. '/Sweave/myfile.pdf'.
To answer your P.S., if every project is in a separate project folder, you will have to set this up for every project since you have to specify single main .tex and output files.

Install4j create user data directory

Install4j has the system variable sys.docsdir that will create a data directory in the proper place. But I can not find an action to add to the installation that will create an empty directory. What is the action? If I need to create custom script, a sample would be awesome.
The installer variable sys.docsdir contains the path to the user-specific "Documents" folder on Windows, it does not create a directory.
To install files into a subfolder of the sys.docsdir directory, add a new root under Files->Define distribution tree with the name ${installer:sys.docsdir}/myfolder and add the files below that folder.
To install to a folder that is resolved at runtime, the name of the installation root can contain your own installer variable, like ${installer:myDataDir}. In that case, you have to define that variable (for example with a "Set a variable" action) before the "Install files" action runs.
You may find your answer here, in the following link:
http://blog.ej-technologies.com/2010/12/more-installation-options-with.html
Hope it helps you.

Viewing a modified file in eclipse

I was adding a simple file to one of my programs that updates when I run the program with a particular parameter.
The file updated fine, but it is stored in the /bin directory and I can't figure out how to view the file within the editor.
I can see that the file is updated when I traverse the bin folder manually and open it with notepad.
Is there a way to view the file within the editor?
edit: I have a file in the project already but I doesn't update, instead the copy in the bin folder does; Can I connect the two somehow?
Your <project>/bin directory is being filtered from view. Right click on your project, select Show In->Navigator then you should be able to see your /bin directory and double click your file to have it open in an editor.
Alternatively, you can use ctrl-shift-r to open the Open Resource dialog, from the triangle drop down menu check Show Derived Resources, and then type in the name of your file.
The /bin directory is managed by the Eclipse builders and so you may lose your file if you do a clean. I would suggest using a different directory to house your runtime files.

How to rename the folder name in xcode project with out corrupting the files

In my xcode project i have created a folder manually named "MyClasses" to place the newly added files/classes to this folder.
Now i have nearly 30 classes in this folder.
when i renamed this folder , all the files in this folder are gets Erased.
Now i need to rename the folder to "ViewControllerClasses".
But i lost 30 .h, .m, xib files. [lucky i have a copy & and zip file]
How to rename the folder with out corrupting the files.
Renamed it to myviewcontrollerclasswes
When i renamed
Two Solutions
Method_1. Try Manual editing:
« Drag your MedChart.xcodeproj to TextWrangler (or any text editor)
« Use find button to find "FolderName" (Your folder name)
« Replace all with new name.
« In some project you may notice header search path problem...goto header search path and replace with new name.
Method_2. Use Xcode to choose base folder:
Rename folder in finder then use Xcode to choose same folder.
NOTE as of 2017:
Now Xcode 9 synchronises the folder and the project hierarchy automatically.
NOTE as of 2013:
Duplicate and rename Xcode project & associated folders
The "folders" what you see in XCode under your project file are not real folders in the file system, only virtual folders administered in the .xcodeproj file. You can organize your files in the project folder independently from their location in the file system. Some prefers to map the file system folder structure inside the project folder structure, some others store all source files in one big folder in the file system and organize them only in the project folders: it's rather a question of preference.
However if you rename/move physically the files in the file system, you will have to delete and re-add them to your project since XCode will not know where to find them. Pay attention not to delete them physically only remove them from XCode project, then re-add them and reorganize as you want.
One more thing to note: if you are using version control system you will have to inform also its client (svn or git most likely) that you have renamed/moved your files. If you want to keep file revision history it will be a good idea to issue the copy/move command explicitly to the version control otherwise it will treat your files as deleted from the old location and added as new in the new location.
In case anyone is still having trouble with this:
Select the folder or file in the left-side bar of XCode corresponding to the folder you want to rename (for me I renamed the folder containing all my files so I selected the topmost folder)
On the right-side bar, below where it says 'Location', click the folder icon.
In the file explorer that opens up rename the existing folder to whatever name you'd like it to be, then afterwards select it and press 'Ok'.
XCode should update the file locations accordingly.
Keep in mind that if you rename something which contains a file that is hard-coded as a certain path in your build settings, XCode will throw an error. You'll have to manually change those paths in your build settings.
This worked for me, hope it works for you too.
You should just run a search and replace on the project file (if you are working with version control and with other developers you will have seen this file a lot without a doubt), it's the project.pbxproj file located inside the xxxxxxxx.xcodeproj file.
Just right click (Control + Click) on the file and select "Show Package Contents" to find the xcodeproj file.
I still find it easier than all these methods to simply create a new folder in your file navigator and then drag your files from the other folder into it. Sometimes the simplest way is the best way. It literally takes me 10 seconds and I don't need to leave Xcode.

External output folder in eclipse

Is there a way in eclipse to make the project's output folder an external folder, instead of a folder located under the project root?
Yes, you can define it as a linked folder.
This this SO answer for more (or this one)
To create a new linked folder select New->Folder, input bin in the folder name: field then click Advanced>>
Click Link to folder in the file system
Click on Variables... to bring up the Select Path Variable dialog.
If this is your first time, or you are linking to a new location select New... and give the variable a sensible name and path.
More precisely, you define your output directory (say 'bin') as a linked folder, then you set that directory as the official output one of your project.