Copying a KDevelop project to another directory - kdevelop

What is the best way to copy an existing KDevelop project folder to another directory, so that the new project contains all the correct directory settings and configuration and there is as little manual editing (and thus less room for error) as possible?
There is some information about someone being successful here about copying the project and then editing every reference to the old path, but this is exactly what I'm hoping to avoid.
In fact, the Kdevelop manual specifically recommends against doing this (see manual, chapter 8, "Project Hacking" [would post a link but I'm nerfed for now]).
This project is shared on an SCM and should have as little dependency on a particular user as possible.

Project-files are project-related and therefore contain a lot of absolute paths etc. Its mostly easier to just import the sources again as a new project.
I'm using CMake which means that I just need to reset build-paths and the install-prefix. Sometimes environment variables needs to be added but thats just copy+paste.

I just had the same problem. An answer to a related question brought me to the following approach:
One can keep (and put under version control) the file <project name>.kdev4 in the top directory of the project. (At least in my case, it doesn't contain any absolute paths.)
The hidden directory .kdev4/ in the top directory of the project should be deleted after copying (and excluded from version control) while kdevelop has not loaded the project.
The project can now easily be reopened by kdevelop using Project -> Open / Import. After pointing kdevelop to the top directory of the project, the file <project name>.kdev4 is recognized and can be accepted. kdevelop then asks for the missing options.
This solution should be clean and cause minimal overhead when continuing work on a project in another directory. In my case, when reopening a cmake project, I could simply accept the proposed defaults. The hidden directory .kdev4/ is recreated when closing kdevelop.

Related

Why project structure files and directories not show in PyCharm [duplicate]

I'm working with PyCharm 2019 and Django, in Windows 10 in a project that I haven't opened in a year. The Project files window is showing up as yellow, which seems new. What does this mean and how to I get the files to appear as white.
What the yellow background usually means is that the files are excluded form the project (it can also mean the files are "read-only").
This might happen for several reasons, the .idea folder might have broken and you need to delete it and recreate the project. If your project is installed in a venv sometimes the source files are marked read-only (which means the source files being edited are the versions installed in the venv).
So here it gets complicated because it can depend on the specifics of the project itself.
My usual steps for this problem are:
Close and reopen the project.
See if marking one of the directories as sources root changes the file color in the project tree. (Files might have been marked as excluded from the project for whatever reason.)
Just to help diagnosing the issue, open a search and go to costum scopes, see what scope those directories are associated with.
Check if file permissions are read-only. This can happen if you logged into PyCharm (or the OS) with a user account that doesn't have editing permissions on those files.
Delete the .idea folder (so the IDE recreates it) and create a new project with those files. (Remember to make a backup copy.)

Changing Directory of STM32CubeIDE Projects

When I create a new STM32CubeIDE project, it default saves it to my /Documents directory. This isn't too bad except I like to have a folder for each application so that it isn't just a bunch of files. I tried creating a folder called "STM32CubeIDE" to save new projects to, put it gives me an error: "overlaps the location of another project".
I've done some googling and found that this issue also exists in Eclipse (which makes sense) but couldn't solve my problem from those solutions.
I was also wondering if there is a way to move all of my existing projects to this newly created folder? Last time I tried, the IDE flipped out on me and couldn't find my stuff.
First of all, do not call your folder "STM32CubeIDE" if this already exists. Use a different name, because this is normally used by default and it may cause issues (probably the reason why you are getting that error).
When you install or update STM32CubeIDE it gives you the option to choose where you want your default folder to be. For example, my default folder is
C:\Users\%USERPROFILE%\STM32CubeIDE\workspace_1.6.0\
Now if you want to use different folders for different projects, there are two options:
You can Export your project (application) to a desired folder and then Import it using the File tab. This is a good method if you want to make backups, or just want to make sure that all relevant files are transferred correctly to avoid "missing file" issues.
The other method (my favourite) is to simply copy you project folders and paste them to a different folder, wherever you want to put them. Then you simply open STM32CubeIDE, go to File > Open Projects from File System... and chose your project. You might get a pop-up about software compatibility issues (if you made an update), etc. but this should open up your project and show it in the Project Explorer.

How to fix function (that validates input) from not reading a text file? [duplicate]

Trying out the Clion EAP on the Mac. How does one change the current working directory for a launched program? It appears to be set to the output directory of the binaries.
This can be changed via the Run -> Edit Configurations... dialog, just like Idea.
The mix of needing to make changes to CMakeLists.txt for so much of the configuration just threw me, and I've been hunting for a way to change it there, but this bit at least is consistent with the other IDEs, which is good.
Hopefully they'll improve the rest of the Project Settings in a similar fashion.
The "Working Directory" is where the executable starts. Modifying the "Working Directory" in the Configurations setting tells Clion to change to the "Working Directory" after the executable starts execution.
If you want to change where the executable starts execution you will need to add a line to the CMakesLists.txt file.
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
add_executable(TimeServer ${SOURCE_FILES})
Position in the cmakes file is important. If you add the set command after the add_executable it will not work. It must come before.
These answers are relatively old. Not sure when the feature was added but there's a very nice UI way to set the current working directory now.
I made a YouTube tutorial for my COSC1030 (Beginning C++) students but the solution is the same for everyone:
https://youtu.be/dTtZEAfh_LM
If you know your CLion fairly well and don't need a demo, here's a short-hand version: Edit Configurations (from drop-down menu at top right of screen), enter the directory you want to use in Working Directory or select via "..." pop-up.

Include assets in build (SDL-2 game project in C)

I am making game project with SDL-2, coding in C. IDE is Code::Blocks v17.12. I have an issue with my assets folder.
Including assets in the game is no problem. I put them in just like this:
SDL_Surface* temp_surface = IMG_Load("assets/player.png");
Naturally, this will only work if my project directory has a folder called "assets", which itself has a file called "player.png".
The issue is that this remains the case when the project is build. In my "Release" folder (or wherever I put the build,) "Assets" has to be there, sitting next to the '.dlls' and the '.exe'. This is very sub-optimal. I would not like for a casual user to so easily view the assets of my game.
I have attempted the problem solved by going to Project > Build Settings > Search Directories > Resource Compiler and then adding my assets folder. That did not work, and I'll admit to not knowing what "Resource compiler" actually does, I just took a guess based on the name.
I would be willing to switch to C++, were that to offer the only feasible means of solving this problem. I have not started any projects yet (just scoping out my environment and tools,) and so am willing to change much in order to get the facilities working correctly.
PhysicsFS & binary-embed the resulting archive into your executable using your favorite method.

NetBeans deletes my resources when cleaning or renaming the project

I have been having a troublesome issue working with NetBeans:
I have a program which uses big amounts of images, text files and sounds. I place them all on a "resources" folder inside the "build" folder. I have read that is the right way, since NetBeans uses this folder as "root" for the project. The BIG problem comes when I press by mistake "clean and build", or rename the project, since both actions ERASE THE WHOLE build directory. When this happens, I lose all of my data, and have to start over editing images, etc. Please notice that I make backups, but I still have to start over since last backup (the image files are changed very frequently), so this is not a definitive solution. Since this is a long-term Java project, it has happened several times, and it is very frustrating.
Is there a way to place my resources on a directory OUTSIDE of my project folder? In case there is not, can I somehow configure NetBeans so it places the deleted files somewhere (like trash bin or somewhere else)?
If it helps, I'm working under OSX system, but I think the same would apply for other operating systems.
I have seen similar questions have been posted, but not solved. Please help!!
I finally worked it out!
If you put the resources directory under the src folder of the proyect, when you clean and build the project, NetBeans will make a copy of this for you, on the build folder. This is not intuitive at all. I would still like to know if it is possible to access any folder out of the project folder, like the Desktop for example.

Resources