This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

tools.pi: fix permission sound patch

+5 -4
+5 -4
tools/pi/patch-permission-sound.py
··· 8 8 9 9 src = open(ts_file).read() 10 10 11 - replacement = """function playPermissionSound(): void { 11 + # Use a lambda for replacement to avoid re.sub interpreting backslash sequences 12 + replacement = r"""function playPermissionSound(): void { 12 13 const isMac = process.platform === "darwin"; 13 14 if (isMac) { 14 15 exec('afplay /System/Library/Sounds/Funk.aiff 2>/dev/null', (err) => { 15 - if (err) process.stdout.write("\\x07"); 16 + if (err) process.stdout.write("\x07"); 16 17 }); 17 18 } else { 18 19 const n = Math.floor(Math.random() * 4) + 1; 19 - exec(`""" + pw_play + """ "$HOME/src/sounds/games/Warcraft III/Units/Orc/Peon/PeonWhat${n}.wav"`, () => {}); 20 + exec(`""" + pw_play + r""" "$HOME/src/sounds/games/Warcraft III/Units/Orc/Peon/PeonWhat${n}.wav"`, () => {}); 20 21 } 21 22 }""" 22 23 23 24 result = re.sub( 24 25 r'function playPermissionSound\(\): void \{.*?\n\}', 25 - replacement, 26 + lambda m: replacement, 26 27 src, 27 28 flags=re.DOTALL, 28 29 )