▾
  • Page::
  • 1

TOPIC: How to apply patch to sourcode? (Linux)

How to apply patch to sourcode? (Linux) 8 years 4 months ago #6641

Hi, I've been compiling OpenTTD from the sources with each OpenTTD version for few years now and each time I used:
patch -p0 -i Diff.file

but now it doesn't seem to work any more.

It gives the following output:
Code:
au@howth:~/tmp/openttd-1.8.0$ patch -p0 -i BTPro_Client_1.8.0_B_180002_git.diff can't find file to patch at input line 5 Perhaps you used the wrong -p or --strip option? The text leading up to this was: -------------------------- |diff --git a/projects/generate_vs100.vcxproj b/projects/generate_vs100.vcxproj |index 4417308..84f8f59 100644 |--- a/projects/generate_vs100.vcxproj |+++ b/projects/generate_vs100.vcxproj -------------------------- File to patch:

There have been obviously some changes with OpenTTD development being moved to Git. But so far I didn't find out how to apply BTPro Client patch. Any idea? I also tried "git apply" but it gives the following:
Code:
au@howth:~/tmp/openttd-1.8.0$ git apply BTPro_Client_1.8.0_B_180002_git.diff BTPro_Client_1.8.0_B_180002_git.diff:583: trailing whitespace. /* BTPro_Client_1.8.0_B_180002_git.diff:614: trailing whitespace. static const std::string base64_chars = BTPro_Client_1.8.0_B_180002_git.diff:985: trailing whitespace. NWidget(WWT_EMPTY, COLOUR_GREY, WID_CT_INCOME),SetMinimalSize(108, 0),SetFill(1, 0), SetPadding(2,2,2,2), SetResize(1, 1), BTPro_Client_1.8.0_B_180002_git.diff:1164: trailing whitespace. case NIC_TOKEN_WEBSITE: BTPro_Client_1.8.0_B_180002_git.diff:1168: trailing whitespace. case NIC_TOKEN_WIKI: error: patch failed: projects/settingsgen_vs100.vcxproj:1 error: projects/settingsgen_vs100.vcxproj: patch does not apply
  • au
  • au's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 35
  • Thank you received: 2

Please Log in or Create an account to join the conversation.

Last edit: by au.

How to apply patch to sourcode? (Linux) 8 years 4 months ago #6642

I figured it out, the command is:
Code:
git apply --stat BTPro_Client_1.8.0_B_180002_git.diff
The following user(s) said Thank You: ST2, tomb
  • au
  • au's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 35
  • Thank you received: 2

Please Log in or Create an account to join the conversation.

How to apply patch to sourcode? (Linux) 8 years 4 months ago #6643

glad you figured it out. I was to suggest patch -p1 < file.diff but never tested it ^^

Enjoy the games :)
  • ST2
  • ST2's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 1222
  • Thank you received: 628

Please Log in or Create an account to join the conversation.

How to apply patch to sourcode? (Linux) 8 years 2 months ago #6693

au wrote: I figured it out, the command is:

Code:
git apply --stat BTPro_Client_1.8.0_B_180002_git.diff


That doesn't actually apply the patch for me. It in fact changes no files for me.

Instead I do this:
Code:
patch -p1 < BTPro_Client_1.8.0_B_180002_git.diff || true

The "|| true" is because one file fails to apply, however that is a VS file and we don't need VS on linux so it doesn't matter.
The following user(s) said Thank You: Frank, au
  • gentz
  • gentz's Avatar
  • Offline
  • New Member
  • New Member
  • Posts: 6
  • Thank you received: 6

Please Log in or Create an account to join the conversation.

Last edit: by gentz.
▴
  • Page::
  • 1
Time to create page: 0.372 seconds
Copyright 2026 BTPro - OpenTTD Community.