<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://bf2tech.uturista.pt/index.php?action=history&amp;feed=atom&amp;title=Scripts%3AModifiedDemoRotator</id>
	<title>Scripts:ModifiedDemoRotator - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://bf2tech.uturista.pt/index.php?action=history&amp;feed=atom&amp;title=Scripts%3AModifiedDemoRotator"/>
	<link rel="alternate" type="text/html" href="https://bf2tech.uturista.pt/index.php?title=Scripts:ModifiedDemoRotator&amp;action=history"/>
	<updated>2026-08-06T00:33:49Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.40.1</generator>
	<entry>
		<id>https://bf2tech.uturista.pt/index.php?title=Scripts:ModifiedDemoRotator&amp;diff=134&amp;oldid=prev</id>
		<title>Pireax: Created page with &quot;__TOC__ ==  What It Does  ==  * Checks to see if your demo path and demo target path are the same before moving. This is mainly only useful if you don&#039;t want your demos moved,...&quot;</title>
		<link rel="alternate" type="text/html" href="https://bf2tech.uturista.pt/index.php?title=Scripts:ModifiedDemoRotator&amp;diff=134&amp;oldid=prev"/>
		<updated>2018-06-22T15:38:39Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;__TOC__ ==  What It Does  ==  * Checks to see if your demo path and demo target path are the same before moving. This is mainly only useful if you don&amp;#039;t want your demos moved,...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;__TOC__&lt;br /&gt;
==  What It Does  ==&lt;br /&gt;
&lt;br /&gt;
* Checks to see if your demo path and demo target path are the same before moving. This is mainly only useful if you don&amp;#039;t want your demos moved, but you still want them regularly pruned. (Or if you have your demo path symlinked to your web directory.)&lt;br /&gt;
* &amp;lt;code&amp;gt;chmod&amp;lt;/code&amp;gt;s all demo files &amp;lt;code&amp;gt;0644&amp;lt;/code&amp;gt; so they can be downloaded through the web or in-game.&lt;br /&gt;
&lt;br /&gt;
==  Installation  ==&lt;br /&gt;
&lt;br /&gt;
# Browser to &amp;lt;code&amp;gt;adminutils/demo/&amp;lt;/code&amp;gt; in your bf2 server directory&lt;br /&gt;
# Backup &amp;lt;code&amp;gt;rotate_demo.py&amp;lt;/code&amp;gt;. (&amp;lt;code&amp;gt;cp rotate_demo.py rotate_demo.py.bak&amp;lt;/code&amp;gt;.)&lt;br /&gt;
# Download rotate_demo.py.patch or copy the below text into a file manually.&lt;br /&gt;
# Patch &amp;lt;code&amp;gt;rotate_demo.py&amp;lt;/code&amp;gt;: &amp;lt;code&amp;gt;patch -p0 rotate_demo.py &amp;lt; rotate_demo.py.patch&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Code  ==&lt;br /&gt;
&lt;br /&gt;
===  Downloadable  ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;s&amp;gt;[http://dackz.net/misc/code/rotate_demo/rotate_demo.py.patch http://dackz.net/misc/code/rotate_demo/rotate_demo.py.patch]&amp;lt;/s&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Readable  ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--- rotate_demo.py.orig    2005-06-26 16:02:51.000000000 -0400&lt;br /&gt;
+++ rotate_demo.py    2005-06-26 16:06:34.000000000 -0400&lt;br /&gt;
@@ -79,13 +79,14 @@&lt;br /&gt;
     ensure_exists(os.path.join(options[&amp;#039;target_root&amp;#039;], &amp;#039;demos&amp;#039;))&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
-    # try to move the fail, or fail miserably&lt;br /&gt;
-    try:&lt;br /&gt;
-        # NOTE: this requires atleast Python 2.3&lt;br /&gt;
-        print &amp;quot;moving &amp;#039;%s&amp;#039; to &amp;#039;%s&amp;#039;&amp;quot; % (path, target_demo_dir)&lt;br /&gt;
-        shutil.move(path, target_demo_dir)&lt;br /&gt;
-    except IOError:&lt;br /&gt;
-        sys.exit(1)&lt;br /&gt;
+    # don&amp;#039;t move if path and target are the same&lt;br /&gt;
+    if os.path.abspath(os.path.dirname(path)) != os.path.abspath(target_demo_dir):&lt;br /&gt;
+        try:&lt;br /&gt;
+            # NOTE: this requires atleast Python 2.3&lt;br /&gt;
+            print &amp;quot;moving &amp;#039;%s&amp;#039; to &amp;#039;%s&amp;#039;&amp;quot; % (path, target_demo_dir)&lt;br /&gt;
+            shutil.move(path, target_demo_dir)&lt;br /&gt;
+        except IOError:&lt;br /&gt;
+            sys.exit(1)&lt;br /&gt;
 &lt;br /&gt;
     timestamped = []&lt;br /&gt;
 &lt;br /&gt;
@@ -93,6 +94,7 @@&lt;br /&gt;
     for pf in filter(lambda x: x.endswith(&amp;#039;.bf2demo&amp;#039;), os.listdir(target_demo_dir)):&lt;br /&gt;
         try:&lt;br /&gt;
             ppath = os.path.join(target_demo_dir, pf)&lt;br /&gt;
+            os.chmod(ppath, 0644) # make web-readable&lt;br /&gt;
             timestamped.append((os.stat(ppath).st_mtime, ppath))&lt;br /&gt;
         except IOError:&lt;br /&gt;
             pass # don&amp;#039;t let I/O errors stop us&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Pireax</name></author>
	</entry>
</feed>