下面是相对路径:
string url1 = "/.DS_Store";
string url2 = "/src/.DS_Store";
string url3 = "/src/androidTest/java/thereisnospon/mcode/ApplicationTest.java";
string url4 = "/src/main/.DS_Store";
string url5 = "/src/main/AndroidManifest.xml";
string url6 = "/src/main/java/thereisnospon/mcode/IndexActivity.java";
string url7 = "/src/main/res/layout/activity_index.xml";
通过上面7个相对路径,生成文件夹的目录结构,然后转成json
3 个解决方案
#1
自顶!!!!
#2
你至少把你想转换的结果写一下吧
#3
[{
"name":"root",
"dirs":[{
"name":"src",
"dirs":[{
"name":"main",
"dirs":[{
"name":"java",
"dirs":[{
"name":"thereisnospon",
"dirs":[{
"name":"mcode",
"dirs":[],
"files":[{
"name":"IndexActivity.java"
}]
}],
"files":[]
},{
"name":"res",
"dirs":[{
"name":"layout",
"dirs":[],
"files":[{
"name":"activity_index.xml"
}]
}],
"files":[]
}],
"files":[]
}],
"files":[{
"name":".DS_Store"
},{
"name":"AndroidManifest.xml"
}]
},{
"name":"androidTest",
"dirs":[],
"files":[]
}],
"files":[{
"name":".DS_Store"
}]
}],
"files":[{
"name":".DS_Store"
}]
}]
构建成这样的json就可以了
#1
自顶!!!!
#2
你至少把你想转换的结果写一下吧
#3
[{
"name":"root",
"dirs":[{
"name":"src",
"dirs":[{
"name":"main",
"dirs":[{
"name":"java",
"dirs":[{
"name":"thereisnospon",
"dirs":[{
"name":"mcode",
"dirs":[],
"files":[{
"name":"IndexActivity.java"
}]
}],
"files":[]
},{
"name":"res",
"dirs":[{
"name":"layout",
"dirs":[],
"files":[{
"name":"activity_index.xml"
}]
}],
"files":[]
}],
"files":[]
}],
"files":[{
"name":".DS_Store"
},{
"name":"AndroidManifest.xml"
}]
},{
"name":"androidTest",
"dirs":[],
"files":[]
}],
"files":[{
"name":".DS_Store"
}]
}],
"files":[{
"name":".DS_Store"
}]
}]
构建成这样的json就可以了