Jump to content

Is there an easy way to figure out in game where a part is saved to in the game data follder?


Rabada

Recommended Posts

Sometimes I like to do some part pruning of mods, or there may be a part I wish to edit, and I'll end up spending 10 to 15 minutes jet to find the .cfg file for that part. Is there an easy way to track down the .cfg of a part?

Link to comment
Share on other sites

Not incredibly easy, no. If you do not know what mod it came from, you can sometimes divine it from the listed manufacturer in-game. Most mods use their own little name.

Once you figure out the mod, it will be in that mods folder (99% of the time) and from there you can kind of guess from their folder structure based on the name of the part. The part name will be in the *.cfg file exactly as shown in game.

Not an "easy" way, but it's as close as you are going to get.

Link to comment
Share on other sites

This method may be...awful...but it'd work.

1) Build a vessel in the VAB (or SPH) and attach only one of each part you'd like to find.

1a) Save the vessel with a name you'll remember.

1b) Close KSP.

2) Open your file browser and navigate to the main KSP install.

2a) Open your .craft file in a text editor.

2b) Open KSP.log (in the main KSP directory) in a new text editor window.

3) In your .craft file, use the search function to search for "part = "

3a) You'll find a line like "part = dockingPort2_4294534820". The portion before the _4294534820 is the name of the part. (The _4294534820 is random and is added to create a unique name for the part on the vessel).

3b) In KSP.log, use the search function to find "dockingPort2". You'll get a line like "[LOG 18:53:32.896] Config(PART) Squad/Parts/Utility/dockingPort/dockingPort/dockingPort2"

3c) This means that the part is defined in your GameData/Squad/Parts/Utility/dockingPort/dockingPort.cfg

Do 3 - 3c for each part in the .craft file.

Cheers!

Link to comment
Share on other sites

It depends on the OS you're using. In OS X and Linux, you can always use grep:


uruk:GameData jltsiren$ grep -ri --include *.cfg "a more reasonable engine" .
./Squad/Parts/Engine/liquidEnginePoodle/liquidEnginePoodle.cfg:description = A more reasonable engine for rough economic times, the Poodle engine doubles as a BBQ when at low power.

Link to comment
Share on other sites

It depends on the OS you're using. In OS X and Linux, you can always use grep:


uruk:GameData jltsiren$ grep -ri --include *.cfg "a more reasonable engine" .
./Squad/Parts/Engine/liquidEnginePoodle/liquidEnginePoodle.cfg:description = A more reasonable engine for rough economic times, the Poodle engine doubles as a BBQ when at low power.

Yes...I tried searching how to get Windows to search inside .cfg files, but it's not abundantly clear if it's even possible.

Link to comment
Share on other sites

Not incredibly easy, no. If you do not know what mod it came from, you can sometimes divine it from the listed manufacturer in-game. Most mods use their own little name.

...

Not an "easy" way, but it's as close as you are going to get.

A) Use the .dll from filter extensions, sorts all parts by folder instead of manufacturer. No divining involved

B) (As a seperate plugin) I could easily copy that piece of code and just have it log the complete path to every part once KSP hits the main menu (possibly earlier). Not something I'd get any use out of, but it's a 5 minute job to do. That would be the easy solution.

Link to comment
Share on other sites

Kujuman: I think I could do that! That sounds like a great idea! thanks!

It depends on the OS you're using. In OS X and Linux, you can always use grep:


uruk:GameData jltsiren$ grep -ri --include *.cfg "a more reasonable engine" .
./Squad/Parts/Engine/liquidEnginePoodle/liquidEnginePoodle.cfg:description = A more reasonable engine for rough economic times, the Poodle engine doubles as a BBQ when at low power.

I actually spent 6 or 7 hours a week ago figuring out how to install Ubuntu onto a spare hard drive JUST for the sole purpose of playing KSP. So the only thing I know about Linux is to just barely know how to get KSP running. My KSP install seems to get a bit laggy when it uses more than 8 gB of RAM, so I wanted to get rid of some parts I am sure I won't use.

So what's this grep thing you are referring to?

Link to comment
Share on other sites

So what's this grep thing you are referring to?

grep is a standard Unix search tool dating back to the 70s. Like most Unix tools, you use it in a terminal. In this case, the command is


grep -ri --include *.cfg "a more reasonable engine" .

and you run it in the GameData directory. grep is the name of the program, -ri tells grep to continue the search recursively in all subdirectories it encounters (-r) and to do a case-insensitive search (-i), --include *.cfg restricts the search to files with extension .cfg, "a more reasonable engine" is the pattern (actually a regexp) to search for, and . tells grep to search the current directory.

There are probably similar command line tools in Windows as well, but I can't check what they are and how they work, because computers running Windows are so hard to find these days.

Link to comment
Share on other sites

The windows built in FindStr is entirely usable for this, and many basic grep like uses e.g.

C:\Programs\KSP_win\GameData>FindStr /S "LV-909" *.cfg

outputs:

Squad\Parts\Engine\liquidEngineLV-909\liquidEngineLV-909.cfg:// LV-909 Liquid Fuel Engine

Squad\Parts\Engine\liquidEngineLV-909\liquidEngineLV-909.cfg:title = LV-909 Liquid Fuel Engine

Squad\Parts\Engine\liquidEnginePoodle\liquidEnginePoodle.cfg:// LV-909 Liquid Fuel Engine

Link to comment
Share on other sites

On Linux (and maybe Mac OS X; I only have G5-and-older Macs available to me, and they're too loud to use this late at night):

[noparse]find GameData/ -type f -iname '*.cfg' -print0 | xargs -i -0 -P $some_number -- grep --color=yes -nHi $part_id {}[/noparse]

seems to work, and appears to be slightly faster (on my machine) than grep -r when $some_number=5.

$some_number == number of jobs to run in parallel (faster than just passing "-exec grep -nHi $part_id {} \;" to find, unless your computer is afflicted with The World's Slowest 5200RPM Hard Diskâ„¢ or other impediments to disk I/O)

$part_id == the internal name of the part (gets logged to the debug log on delete instead of on instantiate; pick up the part, drop it on the part list, and check the end of the debug log)

Edited by Fail-Man 3D
Lame excuse for not testing on Mac
Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...