Skip to content

Commit

Permalink
fix src dir search issue
Browse files Browse the repository at this point in the history
  • Loading branch information
mmin18 committed Aug 16, 2015
1 parent 1f3ef31 commit 5e38012
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 19 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ Usually the activity will keep its running state in **onSaveInstanceState()** an

## Troubleshooting

- It can only find /src folder under <project>/src or <project>/src/main/src
- It can only find /src folder under <project>/src or <project>/src/main/java
- It can only find /res folder under <project>/res or <project>/src/main/res
- You can add new or replace resources, but you can't delete or rename resources (for now)
- If cast failed, clean your project, remove /bin and /build and rebuild again may solve the problem
30 changes: 12 additions & 18 deletions cast.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,23 +222,16 @@ def countSrcDir2(dir, lastBuild=0, list=None):
return (count, lastModified)

def srcdir2(dir, lastBuild=0, list=None):
dir1 = os.path.join(dir, 'src')
dir2 = os.path.join(dir, 'src' ,'main', 'src')
list1 = None
list2 = None
if list!=None:
list1 = []
list2 = []
(a, ma) = countSrcDir2(dir1, lastBuild=lastBuild, list=list1)
(b, mb) = countSrcDir2(dir2, lastBuild=lastBuild, list=list2)
if b>a:
for srcdir in [os.path.join(dir, 'src', 'main', 'java'), os.path.join(dir, 'src')]:
olist = None
if list!=None:
list.extend(list2)
return (dir2, b, mb)
else:
if list!=None:
list.extend(list1)
return (dir1, a, ma)
olist = []
(count, lastModified) = countSrcDir2(srcdir, lastBuild=lastBuild, list=olist)
if count>0:
if list!=None:
list.extend(olist)
return (srcdir, count, lastModified)
return (None, 0, 0)

def libdir(dir):
ddir = os.path.join(dir, 'libs')
Expand Down Expand Up @@ -560,8 +553,9 @@ def search_path(dir, filename):
if os.path.isfile(fpath) and not fn.startswith('.'):
latestResModified = max(latestResModified, os.path.getmtime(fpath))
(sdir, scount, smt) = srcdir2(dep, lastBuild=lastBuild, list=msrclist)
srcs.append(sdir)
latestSrcModified = max(latestSrcModified, smt)
if sdir:
srcs.append(sdir)
latestSrcModified = max(latestSrcModified, smt)
resModified = latestResModified > lastBuild
srcModified = latestSrcModified > lastBuild
targets = ''
Expand Down

0 comments on commit 5e38012

Please sign in to comment.