Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@dockimbel
Created March 21, 2018 08:41
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dockimbel/1c0f51e3044f23688aae696a28d3096b to your computer and use it in GitHub Desktop.
Save dockimbel/1c0f51e3044f23688aae696a28d3096b to your computer and use it in GitHub Desktop.
Red source files header updater
Red []
dive: function [path action [block!] filter [block!]][
bind action 'path
if filter [bind filter 'path]
foreach file read path [
if dir? file [dive append copy path file action filter]
if any [not filter do filter][do action]
]
]
action: [
p: append copy path file
data: read/binary p
foreach rights [
"Nenad Rakocevic. All rights reserved."
"Qingtian Xie. All rights reserved."
][
if pos: find data rights [
change/part pos "Red Foundation" find pos dot
either pos/-6 = #"-" [
pos/-2: #"8"
][
insert skip pos -1 "-2018"
]
write/binary p data
]
]
]
dive %./ action [
all [
file <> %walk-files.red
find [%.red %.r %.reds] suffix? file
]
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment