ijoshsmith / abandoned-strings Goto Github PK
View Code? Open in Web Editor NEWCommand line program that detects unused resource strings in an iOS or OS X application.
License: MIT License
Command line program that detects unused resource strings in an iOS or OS X application.
License: MIT License
When i try to execute the command line in terminal knowing that im in the directory, help me plz i need this tool.
-bash: ./AbandonedStrings: is a directory
Searching for abandoned resource strings…
cannot read file!!! : Error Domain=NSCocoaErrorDomain Code=257 "The file “xxxx” couldn’t be opened because you don’t have permission to view it." UserInfo={NSFilePath=/Users/myname/Documents/MyProject/Pods/xxxxxx.swift, NSUnderlyingError=0x7f8afd9f3e10 {Error Domain=NSPOSIXErrorDomain Code=13 "Permission denied"}}
I tryid every thing I could think of :
chmod X on AbandonString.swift
chmod -R 777 on project folder
and execute command with "sudo"
🤷♂️
Thanks for help.
I Can't run with ./AbandonedStrings <project-folder-path>
.
I need to use ./AbandonedStrings/main.swift <project-folder-path>
instead, with chmod to add execution permission. May be we can update the README to better capture this issue.
Seeing quite a few crashes here: let endIndex = lineWithoutFirstQuote.index(of:"\"")!
It would be best to remove all force unwrapping and make functions like extractStringIdentifierFromTrimmedLine
return optional strings.
Been trying to hand prune our localization files, but they have over 2k strings from over seven years. Tried this out and it didn't find anything abandoned.
Turns out contentsOfFile is reading the strings file using utf8 encoding and our files are utf16. This causes the try to fail and an empty string returned instead of file contents.
Found something mentioned on SO that as of 2016 Apple is using utf8, but a new localization I created yesterday is utf16 as well.
Maybe consider a warning in contentsOfFile catch?
Right now project isn't writing to stdout and stderr so this won't work:
./AbandonedStrings /path/to/project > outputfile.txt
Don't know if you've had this problem, but I got no results running abandoned-strings
on my source. Turned out it was thecontentsOfFile
method failing due to the encoding of the .strings
files not being UTF8 encoded.
I changed the method thusly to fix it.
func contentsOfFile(filePath: String) -> String {
do {
let usedEncoding = UnsafeMutablePointer<NSStringEncoding>()
return try String(contentsOfFile: filePath, usedEncoding: usedEncoding)
}
catch { return "" }
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.