Skip to content

Commit eaaf178

Browse files
committed
Question accesscode-2-2#3 completed
1 parent 5cd4f84 commit eaaf178

File tree

4 files changed

+293
-0
lines changed

4 files changed

+293
-0
lines changed
Binary file not shown.
Lines changed: 246 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,246 @@
1+
// !$*UTF8*$!
2+
{
3+
archiveVersion = 1;
4+
classes = {
5+
};
6+
objectVersion = 46;
7+
objects = {
8+
9+
/* Begin PBXBuildFile section */
10+
153826801C558E0400E27BC7 /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1538267F1C558E0400E27BC7 /* main.swift */; };
11+
/* End PBXBuildFile section */
12+
13+
/* Begin PBXCopyFilesBuildPhase section */
14+
1538267A1C558E0400E27BC7 /* CopyFiles */ = {
15+
isa = PBXCopyFilesBuildPhase;
16+
buildActionMask = 2147483647;
17+
dstPath = /usr/share/man/man1/;
18+
dstSubfolderSpec = 0;
19+
files = (
20+
);
21+
runOnlyForDeploymentPostprocessing = 1;
22+
};
23+
/* End PBXCopyFilesBuildPhase section */
24+
25+
/* Begin PBXFileReference section */
26+
1538267C1C558E0400E27BC7 /* FindMyFiles20160124HomeworkSunCaleb */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = FindMyFiles20160124HomeworkSunCaleb; sourceTree = BUILT_PRODUCTS_DIR; };
27+
1538267F1C558E0400E27BC7 /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = "<group>"; };
28+
/* End PBXFileReference section */
29+
30+
/* Begin PBXFrameworksBuildPhase section */
31+
153826791C558E0400E27BC7 /* Frameworks */ = {
32+
isa = PBXFrameworksBuildPhase;
33+
buildActionMask = 2147483647;
34+
files = (
35+
);
36+
runOnlyForDeploymentPostprocessing = 0;
37+
};
38+
/* End PBXFrameworksBuildPhase section */
39+
40+
/* Begin PBXGroup section */
41+
153826731C558E0400E27BC7 = {
42+
isa = PBXGroup;
43+
children = (
44+
1538267E1C558E0400E27BC7 /* FindMyFiles20160124HomeworkSunCaleb */,
45+
1538267D1C558E0400E27BC7 /* Products */,
46+
);
47+
sourceTree = "<group>";
48+
};
49+
1538267D1C558E0400E27BC7 /* Products */ = {
50+
isa = PBXGroup;
51+
children = (
52+
1538267C1C558E0400E27BC7 /* FindMyFiles20160124HomeworkSunCaleb */,
53+
);
54+
name = Products;
55+
sourceTree = "<group>";
56+
};
57+
1538267E1C558E0400E27BC7 /* FindMyFiles20160124HomeworkSunCaleb */ = {
58+
isa = PBXGroup;
59+
children = (
60+
1538267F1C558E0400E27BC7 /* main.swift */,
61+
);
62+
path = FindMyFiles20160124HomeworkSunCaleb;
63+
sourceTree = "<group>";
64+
};
65+
/* End PBXGroup section */
66+
67+
/* Begin PBXNativeTarget section */
68+
1538267B1C558E0400E27BC7 /* FindMyFiles20160124HomeworkSunCaleb */ = {
69+
isa = PBXNativeTarget;
70+
buildConfigurationList = 153826831C558E0400E27BC7 /* Build configuration list for PBXNativeTarget "FindMyFiles20160124HomeworkSunCaleb" */;
71+
buildPhases = (
72+
153826781C558E0400E27BC7 /* Sources */,
73+
153826791C558E0400E27BC7 /* Frameworks */,
74+
1538267A1C558E0400E27BC7 /* CopyFiles */,
75+
);
76+
buildRules = (
77+
);
78+
dependencies = (
79+
);
80+
name = FindMyFiles20160124HomeworkSunCaleb;
81+
productName = FindMyFiles20160124HomeworkSunCaleb;
82+
productReference = 1538267C1C558E0400E27BC7 /* FindMyFiles20160124HomeworkSunCaleb */;
83+
productType = "com.apple.product-type.tool";
84+
};
85+
/* End PBXNativeTarget section */
86+
87+
/* Begin PBXProject section */
88+
153826741C558E0400E27BC7 /* Project object */ = {
89+
isa = PBXProject;
90+
attributes = {
91+
LastSwiftUpdateCheck = 0720;
92+
LastUpgradeCheck = 0720;
93+
ORGANIZATIONNAME = myApps;
94+
TargetAttributes = {
95+
1538267B1C558E0400E27BC7 = {
96+
CreatedOnToolsVersion = 7.2;
97+
};
98+
};
99+
};
100+
buildConfigurationList = 153826771C558E0400E27BC7 /* Build configuration list for PBXProject "FindMyFiles20160124HomeworkSunCaleb" */;
101+
compatibilityVersion = "Xcode 3.2";
102+
developmentRegion = English;
103+
hasScannedForEncodings = 0;
104+
knownRegions = (
105+
en,
106+
);
107+
mainGroup = 153826731C558E0400E27BC7;
108+
productRefGroup = 1538267D1C558E0400E27BC7 /* Products */;
109+
projectDirPath = "";
110+
projectRoot = "";
111+
targets = (
112+
1538267B1C558E0400E27BC7 /* FindMyFiles20160124HomeworkSunCaleb */,
113+
);
114+
};
115+
/* End PBXProject section */
116+
117+
/* Begin PBXSourcesBuildPhase section */
118+
153826781C558E0400E27BC7 /* Sources */ = {
119+
isa = PBXSourcesBuildPhase;
120+
buildActionMask = 2147483647;
121+
files = (
122+
153826801C558E0400E27BC7 /* main.swift in Sources */,
123+
);
124+
runOnlyForDeploymentPostprocessing = 0;
125+
};
126+
/* End PBXSourcesBuildPhase section */
127+
128+
/* Begin XCBuildConfiguration section */
129+
153826811C558E0400E27BC7 /* Debug */ = {
130+
isa = XCBuildConfiguration;
131+
buildSettings = {
132+
ALWAYS_SEARCH_USER_PATHS = NO;
133+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
134+
CLANG_CXX_LIBRARY = "libc++";
135+
CLANG_ENABLE_MODULES = YES;
136+
CLANG_ENABLE_OBJC_ARC = YES;
137+
CLANG_WARN_BOOL_CONVERSION = YES;
138+
CLANG_WARN_CONSTANT_CONVERSION = YES;
139+
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
140+
CLANG_WARN_EMPTY_BODY = YES;
141+
CLANG_WARN_ENUM_CONVERSION = YES;
142+
CLANG_WARN_INT_CONVERSION = YES;
143+
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
144+
CLANG_WARN_UNREACHABLE_CODE = YES;
145+
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
146+
CODE_SIGN_IDENTITY = "-";
147+
COPY_PHASE_STRIP = NO;
148+
DEBUG_INFORMATION_FORMAT = dwarf;
149+
ENABLE_STRICT_OBJC_MSGSEND = YES;
150+
ENABLE_TESTABILITY = YES;
151+
GCC_C_LANGUAGE_STANDARD = gnu99;
152+
GCC_DYNAMIC_NO_PIC = NO;
153+
GCC_NO_COMMON_BLOCKS = YES;
154+
GCC_OPTIMIZATION_LEVEL = 0;
155+
GCC_PREPROCESSOR_DEFINITIONS = (
156+
"DEBUG=1",
157+
"$(inherited)",
158+
);
159+
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
160+
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
161+
GCC_WARN_UNDECLARED_SELECTOR = YES;
162+
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
163+
GCC_WARN_UNUSED_FUNCTION = YES;
164+
GCC_WARN_UNUSED_VARIABLE = YES;
165+
MACOSX_DEPLOYMENT_TARGET = 10.11;
166+
MTL_ENABLE_DEBUG_INFO = YES;
167+
ONLY_ACTIVE_ARCH = YES;
168+
SDKROOT = macosx;
169+
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
170+
};
171+
name = Debug;
172+
};
173+
153826821C558E0400E27BC7 /* Release */ = {
174+
isa = XCBuildConfiguration;
175+
buildSettings = {
176+
ALWAYS_SEARCH_USER_PATHS = NO;
177+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
178+
CLANG_CXX_LIBRARY = "libc++";
179+
CLANG_ENABLE_MODULES = YES;
180+
CLANG_ENABLE_OBJC_ARC = YES;
181+
CLANG_WARN_BOOL_CONVERSION = YES;
182+
CLANG_WARN_CONSTANT_CONVERSION = YES;
183+
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
184+
CLANG_WARN_EMPTY_BODY = YES;
185+
CLANG_WARN_ENUM_CONVERSION = YES;
186+
CLANG_WARN_INT_CONVERSION = YES;
187+
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
188+
CLANG_WARN_UNREACHABLE_CODE = YES;
189+
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
190+
CODE_SIGN_IDENTITY = "-";
191+
COPY_PHASE_STRIP = NO;
192+
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
193+
ENABLE_NS_ASSERTIONS = NO;
194+
ENABLE_STRICT_OBJC_MSGSEND = YES;
195+
GCC_C_LANGUAGE_STANDARD = gnu99;
196+
GCC_NO_COMMON_BLOCKS = YES;
197+
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
198+
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
199+
GCC_WARN_UNDECLARED_SELECTOR = YES;
200+
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
201+
GCC_WARN_UNUSED_FUNCTION = YES;
202+
GCC_WARN_UNUSED_VARIABLE = YES;
203+
MACOSX_DEPLOYMENT_TARGET = 10.11;
204+
MTL_ENABLE_DEBUG_INFO = NO;
205+
SDKROOT = macosx;
206+
};
207+
name = Release;
208+
};
209+
153826841C558E0400E27BC7 /* Debug */ = {
210+
isa = XCBuildConfiguration;
211+
buildSettings = {
212+
PRODUCT_NAME = "$(TARGET_NAME)";
213+
};
214+
name = Debug;
215+
};
216+
153826851C558E0400E27BC7 /* Release */ = {
217+
isa = XCBuildConfiguration;
218+
buildSettings = {
219+
PRODUCT_NAME = "$(TARGET_NAME)";
220+
};
221+
name = Release;
222+
};
223+
/* End XCBuildConfiguration section */
224+
225+
/* Begin XCConfigurationList section */
226+
153826771C558E0400E27BC7 /* Build configuration list for PBXProject "FindMyFiles20160124HomeworkSunCaleb" */ = {
227+
isa = XCConfigurationList;
228+
buildConfigurations = (
229+
153826811C558E0400E27BC7 /* Debug */,
230+
153826821C558E0400E27BC7 /* Release */,
231+
);
232+
defaultConfigurationIsVisible = 0;
233+
defaultConfigurationName = Release;
234+
};
235+
153826831C558E0400E27BC7 /* Build configuration list for PBXNativeTarget "FindMyFiles20160124HomeworkSunCaleb" */ = {
236+
isa = XCConfigurationList;
237+
buildConfigurations = (
238+
153826841C558E0400E27BC7 /* Debug */,
239+
153826851C558E0400E27BC7 /* Release */,
240+
);
241+
defaultConfigurationIsVisible = 0;
242+
};
243+
/* End XCConfigurationList section */
244+
};
245+
rootObject = 153826741C558E0400E27BC7 /* Project object */;
246+
}

FindMyFiles20160124HomeworkSunCaleb/FindMyFiles20160124HomeworkSunCaleb.xcodeproj/project.xcworkspace/contents.xcworkspacedata

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
//
2+
// main.swift
3+
// FindMyFiles20160124HomeworkSunCaleb
4+
//
5+
// Created by Eric Sze on 1/24/16.
6+
// Copyright © 2016 myApps. All rights reserved.
7+
//
8+
9+
import Foundation
10+
11+
func findFile(name: String, atPath: String) -> String {
12+
let fileManager = NSFileManager.defaultManager()
13+
let contents = try! fileManager.contentsOfDirectoryAtPath(atPath)
14+
15+
for fileOrDir in contents {
16+
var isDir = ObjCBool(false);
17+
let fullPath = atPath + "/" + fileOrDir
18+
let exists = fileManager.fileExistsAtPath(fullPath, isDirectory: &isDir)
19+
20+
if exists && Bool(isDir) {
21+
22+
// YOUR CODE HERE
23+
findFile(name, atPath: fullPath)
24+
print("DIR: " + fileOrDir)
25+
} else if exists {
26+
// YOUR CODE HERE
27+
if (fileOrDir == name){
28+
print("FILE: " + fileOrDir)
29+
print("File is at: \(fullPath)")
30+
return fullPath
31+
}
32+
print("FILE: " + fileOrDir)
33+
} else {
34+
print("NEITHER: " + fileOrDir)
35+
}
36+
}
37+
return "NOT FOUND"
38+
}
39+
40+
print(findFile("cog.png", atPath: "/Users/ericsze/Desktop"))

0 commit comments

Comments
 (0)