Project

General

Profile

Bug #2662 ยป fix-ndnSIM-NFD-includes.sh

Junxiao Shi, 03/22/2015 08:18 AM

 
#!/bin/bash

function fix_file {
F=$1
DEPTH=$2

UP=''
for I in $(seq 2 $DEPTH); do
UP='../'$UP
done

for P in $(ls); do
sed -i -r -e 's~#include "'$P'(["/])~#include "'$UP$P'\1~' $F
done
for P in $(cd core && ls); do
sed -i -r -e 's~#include "'$P'(["/])~#include "'$UP'core/'$P'\1~' $F
done
for P in $(cd daemon && ls); do
sed -i -r -e 's~#include "'$P'(["/])~#include "'$UP'daemon/'$P'\1~' $F
done
}

for DEPTH in $(seq 2 3); do
for F in $(find -mindepth $DEPTH -maxdepth $DEPTH -name '*.hpp'); do
fix_file $F $DEPTH
done
done
    (1-1/1)