I have a directory like this:
htdocs
- shared
- project 1
- css
- JS
- project 2
- css
- JS
etc.
Now I want to create 2 projects, one with the folders shared and project1 and one with the folders shared and project2.
The first project I can create with htdocs as a root folder, and exclude project2 as source directory.
However, when I want to create a new project with htdocs as a root folder, WebStorm sees the already created project.
Is it possible to create the project structure like I want?
Sure. But it involves additional manipulations.
The idea is simple -- store .idea folder (project settings .. and the clue/marker for IDE that this is a project) somewhere else:
Create new empty project somewhere else
Go to Settings/Preferences | Directories
Remove existing Content Root
Add new Content Root -- the folder(s) that you need.
You can A) add both folders as separate content roots (e.g. shared and project 1 as per your example) .. or B) add htdocs and then mark unwanted folders as excluded (so it's not indexed and not participating in code completion etc).
I suggest using A) option in general -- less files to work with for IDE (in B) -- even though the folders are excluded, they are still processed by IDE and can participate in certain activities).
Repeat the same for your 2nd project (for shared and project 2 folders)
https://youtrack.jetbrains.com/issue/WI-343 -- this ticket is for PhpStorm but describes the actual idea.
Alternatively:
Create project in project 1 folder (and not htdocs like you were planning originally)
Add additional Content Root -- add shared folder -- it will be listed as separate node in Project View.
Do the same for your 2nd project.
Related
If my project has the following folder structure:
Project
├───build
├───images
├───include
├───Apps
├───Models
├───source
└───tests
what is the best way to make the folder "images" accessable to all .cpp files inside build, tests, apps and src without using the absolute path. So every image created inside this project should be saved to the "images" folder.
I am building with Cmake if this is important(started using CMake last week so no deep knowledge). Main CmakeLists.txt file is the the root folder. Tests, Apps and source each have their own CMakeLists.txt files and executables.
Every image will be created with the same class so I think I could use std::filesystem::current_path() with a wrapper function inside the class which would generate and set the desired path but there should be another way.
I will also load files from the folder Models in the future, so the same problem.
If I am understanding your question correctly you want to access the images from the "images" folder, right? You should be thinking about the path from the point of the final executable and not the source files.
If the executable will be in the build directory then you simply need to write "../images", the 2 dots mean that you are going back 1 directory.
I use QtCreator for doing C++ applications, and I'm looking to set a relative build directory to QtCreator, but I want all those builds to be inside a "builds" folder, and not at the root of the folder, where the projects are.
For example, actual directory:
CodingFolder
- build-test1-Desktop_Qt[...]
- build-test2-Desktop_Qt[...]
- build-test3-Desktop_Qt[...]
- test1
- test2
- test3
Now, I want to have it like this:
CodingFolder
- builds
- build-test1-Desktop_Qt[...]
- build-test2-Desktop_Qt[...]
- build-test3-Desktop_Qt[...]
- test1
- test2
- test3
But I don't wan't to set an "static" build folder as the default directory. I want the build folders to be created at the same folder where the project is located, BUT inside a "builds" subfolder
Is this possible?
At the options, there's this setting:
Default build directory:
../%{JS: Util.asciify("build-%{CurrentProject:Name}-%{CurrentKit:FileSystemName}-%{CurrentBuild:Name}")}
I tried to add the subfolder at the directory, like this:
|
v
../builds/%{JS: Util.asciify("build-%{CurrentProject:Name}-%{CurrentKit:FileSystemName}-%{CurrentBuild:Name}")}
But it didn't work, the subfolder wasn't created.
The project I tried with compiled, but no subfolder appeared (or I don't know where it was stored, then).
I tried searching before posting this question, but only got how to set an static, specific directory, and I want to keep it relative.
Thanks in advance :)
Here is filter of my project in Visual Studio shown in Solution Explorer :-
ProjectName1
== References, External Dependencies, Header Files, Resource Files
== Source Files
==== myFilter01
------ K.h (system folder = `D:\ProjectName1\K.h`)
------ K.cpp (system folder = `D:\ProjectName1\K.cpp`)
==== myFilter02
====== subFilter2_1
--------- B.h (system folder = `D:\ProjectName1\B.h`)
--------- B.cpp (system folder = `D:\ProjectName1\B.cpp`)
========= subFilter2_2
----------- C.h (system folder = `D:\ProjectName1\C.h`)
----------- C.cpp (system folder = `D:\ProjectName1\C.cpp`)
ProjectName2
== ... (some existing filter/files)
(In real case, all filters contains a lot of sub-sub-filter and files.)
Question
How to :
move all .h and .cpp files (B and C) inside myFilter02 to ProjectName2's folder (e.g. D:\ProjectName2)
don't change appearance of the filter (e.g. C must be still in subFilter2_1\subFilter2_2)
and do it in a few clicks (i.e. not depend on amount of files/sub-filters) i.e. O(1)
Here is the expected result :-
ProjectName1
== References, External Dependencies, Header Files, Resource Files
== Source Files
==== myFilter01
------ K.h (system folder = `D:\ProjectName1\K.h` )
------ K.cpp (system folder = `D:\ProjectName1\K.cpp` )
==== myFilter02
ProjectName2
== ... (some existing filter/files)
== subFilter2_1
----- B.h (system folder = `D:\ProjectName2\B.h` )
----- B.cpp (system folder = `D:\ProjectName2\B.cpp` )
===== subFilter2_2
------- C.h (system folder = `D:\ProjectName2\C.h` )
------- C.cpp (system folder = `D:\ProjectName2\C.cpp` )
It can be done manually for each sub-sub-sub-filter + add existing files, but it is very tedious.
I tried to right click the filter/files, but didn't found such feature.
I currently don't use any Microsoft's source control / repository (just in case it is related).
Note: The normal drag & drop on filters don't move the files to another project's folder.
It just makes the moved files to be a shortcut of the original location (D:\ProjectName1\).
Hotkey? Plugin? Script?
Do I really have to create a program to do this specific thing?
A few days after asking, I have coded it with c++ using RapidXML ~ 500-1000 lines.
I have to edit .vcxproj.filters and .vcxproj of both projects, and move some system files.
I still find no answer about the question, though.
Edit
(After receive advise from Hans Passant and Prab, thank!)
I want to use filter rather than folder for these reasons :-
Source control is easier, because all source files are in a same directory.
In Visual Studio, I can move files around different filters a little easier than around folders.
With Filter, I don't have to lengthen #include "../myFilter01/K.h" or add additional include directories for each folder. I can simple #include "K.h".
If I change the place where a file resides in a filter, I don't have to refactor it.
In case of changing folder, I have to refactor code.
I can use very strange character e.g. =◆██myFilter01██◆= for filters but not folder. It is my taste.
I don't want to
Use folder instead of filter : Beside difficulty of recreate many folders and move my .cpp/.h files manually, I will suffer the above disadvantages.
Use folder with same structure as filter : I have to keep it in sync together manually (all the time - tedious). I will still get some the above disadvantages.
In summary, using folder instead of filter causes me more new trouble than it solves.
It's not one click solution but it could be done faster then manual.
Find out what file need to be copied. To do that move filters from one project to another. Then switch to directory view (show all files) for first project and copy but not past files with small red indicator (files that are not included in the project). Now get back to filter view for both project and move back filters to first project. After that switch both projects to directory view and do pass on second project.
Now we need to create correct filters. Move files from source and header filter to another filters in second project. Unload both projects. Open first and second project .filters files copy from first file to second all filter tags except "Source Files", "Header Files", "Resource Files". Next from second file remove all tags started with source or header. Now from second ItemGroup copy whole content and pass it to second file second ItemGroup. Save second file.
In this point you should have copy of first project filter tree without unnecessary files now just move what you want to correct places.
It is helpful to create single tree in first project.
I have a Teamproject which has only one solution, which contains a MVC web application and a MS Test project (Unit tests).
The Unit test project references the web app.
MyWebApp
MyWebApp.Tests
I can see all files being copied to the Build_SourceDirectory!
But I can only see the MyWebApp.Tests being copied to the Drop folder!?
My Visual Studio buil step:
My Copy Files build step:
Question:
Why does "Copy Files" build step only copy the artifacts of the test project and not the web app, which is in the same solution?
Here is the log file
**\bin\$(BuildConfiguration)\** means you want to copy the files in any sub-folder under bin\$(BuildConfiguration), but MyWebApp's outputs are in bin folder, not under bin\$(BuildConfiguration), so they are not copied.
Specify the Contents in Copy Files task to **\bin\**, you'll get both outputs for MyWebApp and MyWebApp.Tests:
An addition to the provided answer.
With the OOTB minimatch filter:
**\bin\$(BuildConfiguration)\**
you copy everything beneath the BuildConfiguration folder (Release/Debug/etc).
Web apps don't have a Debug/Release folder by default, only one bin folder. That's the reason why anything was copied to the drop folder.
So I had to include some content filters to include/exclude the files/folders I want to copy/don't want to copy, like this:
For exclusions you can use negated filters using the ! sign.
Is it possible to ignore searching the node_modules folder when using WebStorm's navigation pop-up window (Command + Shift + N)?
This makes it really annoying when wanting to quickly navigate to, for example, the package.json file.
To exclude the directory from being searched via navigation pop-up, pick node_modules directory in Project view, then from mouse context menu:
Mark Directory As -> Excluded
Directory could be restored via Preferences->Directories->Excluded Folders settings
In Webstorm 8, you need to also visit Settings > JavaScript > Libraries and disable Node.js core modules and node_modules. The directory exclusion will then work as before.
To exclude node_modules/ files from being searched in "Navigate | File..." popup and to avoid indexing node_modules/ folder, please perform these steps:
Mark node_modules/ folder as excluded in Settings | Directories.
Remove "<your project name> node_modules" library in Settings | Languages & Frameworks | JavaScript | Libraries.
To exclude node_modules folder from all projects (only created after that change) you can add this folder to list of standard folders to ignore.
Open PHPStorm, and close current project File > Close Project.
On startup PHPStorm window click "Configure > Settings".
Then navigate to Build, Execution, Deployment > Deployment > Options.
Now you can set node_modules or anyone else to exclude by default for all new projects.
P.s. Closing the current project is very important. If you do this settings with active project, this will affect only current project.
Exclude the directory: Mark the directory itself as excluded
(Right-Click -> Mark Directory As -> Excluded). It might then
already disappear.
Hide excluded files: Tick the project pane option (under the Gear-Wheel symbol) and un-tick Show Excluded Files to hide excluded
directories
I'm not sure why, but I saw lots of files with "spec" on Ctrl+Shift+n (I can't publish images, sorry :( )
I saw on the contextual menu over the node_modules:
"Mark directory as": "excluded", "test sources root", "resources root"
I went to settings > directories, and I saw the node_modules with red color and can't change it, but, on the left there is list without header (?), I'm not sure if it is the exclude list, but, there is an X, I pushed on it, and restarted the IDE and it works!
If I see the contextual again, I see:
"Mark directory as": "not exclude" and "test sources root".
And in settings > directories I do not see on the lists, but red color on the folder node_modules (weird), I think it is so particular for this folder.
While webstorm tries to keep indexing everything inside your project - while if its a node project - the indexing takes forever, the better ways to exclude the node folder from indexing as below.
Select folder -- Settings|Directories -> Use Exclude - button on folder