[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4688: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4690: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4691: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4692: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
SMPlayer Support Forum • View topic - Version in resource file (Windows)

This forum is deprecated. Please visit https://github.com/smplayer-dev/smplayer/discussions

Version in resource file (Windows)

Forum to talk about the development of SMPlayer (code, patches...).

Version in resource file (Windows)

Postby redxii » Wed Mar 07, 2012 5:46 pm

This is basically just to know what build and version it is without opening it. If PORTABLE_APP is defined it will add "(Portable Edition)" to the description.

I actually got it to update the SVN revision by itself, but I don't know much to edit getrev. I need another #define without the quotes, I deleted them from getrev but QString needs those quotes to be there or else version.cpp won't compile. I would also use version.h so it can be set once for version.cpp and smplayer.rc but the resource compiler says "fatal error: QString: No such file or directory".
Attachments
winfilever.h
(1.8 KiB) Downloaded 360 times
smplayer.rc
(1.11 KiB) Downloaded 326 times
User avatar
redxii
 
Posts: 520
Joined: Thu Dec 24, 2009 7:06 pm

Re: Version in resource file (Windows)

Postby redxii » Thu Mar 08, 2012 9:35 am

Didn't even need getrev.exe to get the revision number, I just used 'svnversion'.

I created a new way to create the SVN version header file. getrev.cmd will get the revision, and fsed.cmd uses a template, svn_revision.h.in, and replaces the '$WCREV$' keyword with the revision in a new file, src\svn_revision.h, like what subwcrev does. svn_revision.h also contains all the version strings, and SVN_USE_REVISION. To edit the version and whether or not to use SVN revision, modify getrev\svn_revision.h.in.
Attachments
getrev.7z
(1.46 KiB) Downloaded 242 times
getrev_new.diff
(2.89 KiB) Downloaded 352 times
no_svn_ver.png
Test run
no_svn_ver.png (90.42 KiB) Viewed 4912 times
Last edited by redxii on Fri Mar 09, 2012 4:22 am, edited 2 times in total.
User avatar
redxii
 
Posts: 520
Joined: Thu Dec 24, 2009 7:06 pm

Re: Version in resource file (Windows)

Postby redxii » Thu Mar 08, 2012 12:36 pm

Could use sed on get_svn_revision.sh:

sed 's:\$WCREV\$:'$NEW_REVISION':' getrev/svn_revision.h.in > src/svn_revision.h
User avatar
redxii
 
Posts: 520
Joined: Thu Dec 24, 2009 7:06 pm

Re: Version in resource file (Windows)

Postby redxii » Fri Mar 09, 2012 5:19 pm

Updated to handle if the user is not using working copy or SVN isn't in the path, and not being able to redefine %REVISION% without closing the command prompt between executions of getrev.cmd. For some reason simply using "set REVISION=%%G" returns "Changed", as opposed to "if not defined REVISION set REVISION=%%G" which gives the right result.

It sets the revision to 0 if it isn't a working copy/missing svn and say "+SVN-rUNKNOWN" if use_svn_revision is 1 AND revision is 0.
Attachments
getrev.7z
(1.83 KiB) Downloaded 258 times
User avatar
redxii
 
Posts: 520
Joined: Thu Dec 24, 2009 7:06 pm

Re: Version in resource file (Windows)

Postby redxii » Sat Mar 10, 2012 8:35 am

User avatar
redxii
 
Posts: 520
Joined: Thu Dec 24, 2009 7:06 pm

Re: Version in resource file (Windows)

Postby redxii » Sun Mar 11, 2012 5:08 am

Actually tested in Kubuntu:
Attachments
linuxscripts_use_svnrevision.h.in.diff
(1.78 KiB) Downloaded 361 times
getrev.7z
(2.72 KiB) Downloaded 256 times
User avatar
redxii
 
Posts: 520
Joined: Thu Dec 24, 2009 7:06 pm

Re: Version in resource file (Windows)

Postby redxii » Mon Mar 12, 2012 1:15 am

Final..

Tested Linux scripts with Kubuntu.
Attachments
getrev_new2.diff
(4.61 KiB) Downloaded 286 times
Untitled.png
Untitled.png (31.39 KiB) Viewed 4746 times
getrev.7z
Windows scripts/template
(1.69 KiB) Downloaded 243 times
User avatar
redxii
 
Posts: 520
Joined: Thu Dec 24, 2009 7:06 pm

Re: Version in resource file (Windows)

Postby rvm » Tue Mar 13, 2012 1:46 pm

svn info --revision HEAD is slow. Don't you get the same result with "svn info" which is faster?
rvm
Site Admin
 
Posts: 3787
Joined: Wed Dec 23, 2009 1:25 am
Location: España

Re: Version in resource file (Windows)

Postby redxii » Tue Mar 13, 2012 9:06 pm

Yeah. Also found a way that doesn't assume it's the 5th line (skip=4) more like grep so it can be found anywhere:

FOR /f "tokens=2" %%i IN ('svn info ^| find "Revision: "') DO set REVISION=%%i
User avatar
redxii
 
Posts: 520
Joined: Thu Dec 24, 2009 7:06 pm


Return to Development

Who is online

Users browsing this forum: No registered users and 9 guests